/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('swas-open', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AddCustomImageShareAccountRequest {
  account?: [ long ](name='Account', description='The IDs of the Alibaba Cloud accounts with which you want to share the custom image.

This parameter is required.'),
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  imageId?: string(name='ImageId', description='The ID of the custom image.

This parameter is required.', example='m-saacssasc****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model AddCustomImageShareAccountResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model AddCustomImageShareAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AddCustomImageShareAccountResponseBody(name='body'),
}

/**
 * @summary Shares a custom image with other Alibaba Cloud accounts in the same region to quickly deploy the same environment configurations for multiple simple application servers at a time. This improves deployment efficiency.
 *
 * @description *   Before you share a custom image, make sure that all sensitive data and files are removed from the image.
 * *   The IDs of the Alibaba Cloud accounts with which you want to share the image is obtained. Move the pointer over the profile in the upper-right corner of the Simple Application Server console. In the card that appears, if Main Account is displayed, the showed account ID is the Alibaba Cloud account ID.
 *
 * @param request AddCustomImageShareAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AddCustomImageShareAccountResponse
 */
async function addCustomImageShareAccountWithOptions(request: AddCustomImageShareAccountRequest, runtime: Util.RuntimeOptions): AddCustomImageShareAccountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.account)) {
    query['Account'] = request.account;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.imageId)) {
    query['ImageId'] = request.imageId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AddCustomImageShareAccount',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Shares a custom image with other Alibaba Cloud accounts in the same region to quickly deploy the same environment configurations for multiple simple application servers at a time. This improves deployment efficiency.
 *
 * @description *   Before you share a custom image, make sure that all sensitive data and files are removed from the image.
 * *   The IDs of the Alibaba Cloud accounts with which you want to share the image is obtained. Move the pointer over the profile in the upper-right corner of the Simple Application Server console. In the card that appears, if Main Account is displayed, the showed account ID is the Alibaba Cloud account ID.
 *
 * @param request AddCustomImageShareAccountRequest
 * @return AddCustomImageShareAccountResponse
 */
async function addCustomImageShareAccount(request: AddCustomImageShareAccountRequest): AddCustomImageShareAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return addCustomImageShareAccountWithOptions(request, runtime);
}

model AllocatePublicConnectionRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  databaseInstanceId?: string(name='DatabaseInstanceId', description='The ID of the Simple Database Service instance.

This parameter is required.', example='db-38263fa955774501a2ae1bdaed6f****'),
  regionId?: string(name='RegionId', description='The region ID of the Simple Database Service instance. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model AllocatePublicConnectionResponseBody = {
  publicConnection?: string(name='PublicConnection', description='The public endpoint that is assigned to the Simple Database Service instance.', example='db-38263fa955774501a2ae1bdaed6f****.mysql.rds.aliyuncs.com'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model AllocatePublicConnectionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AllocatePublicConnectionResponseBody(name='body'),
}

/**
 * @summary Applies for a public endpoint for a Simple Database Service instance.
 *
 * @description By default, no public endpoints are assigned to Simple Database Service instances. If you want to access the databases of a Simple Database Service instance over the Internet by using Simple Container Service or Data Management (DMS), you must apply for a public endpoint for the Simple Database Service instance.
 *
 * @param request AllocatePublicConnectionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AllocatePublicConnectionResponse
 */
async function allocatePublicConnectionWithOptions(request: AllocatePublicConnectionRequest, runtime: Util.RuntimeOptions): AllocatePublicConnectionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.databaseInstanceId)) {
    query['DatabaseInstanceId'] = request.databaseInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AllocatePublicConnection',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Applies for a public endpoint for a Simple Database Service instance.
 *
 * @description By default, no public endpoints are assigned to Simple Database Service instances. If you want to access the databases of a Simple Database Service instance over the Internet by using Simple Container Service or Data Management (DMS), you must apply for a public endpoint for the Simple Database Service instance.
 *
 * @param request AllocatePublicConnectionRequest
 * @return AllocatePublicConnectionResponse
 */
async function allocatePublicConnection(request: AllocatePublicConnectionRequest): AllocatePublicConnectionResponse {
  var runtime = new Util.RuntimeOptions{};
  return allocatePublicConnectionWithOptions(request, runtime);
}

model ApplyFirewallTemplateRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  firewallTemplateId?: string(name='FirewallTemplateId', description='The ID of the firewall template.

This parameter is required.', example='ft-bcf1a7hrdq717****'),
  instanceIds?: [ string ](name='InstanceIds', description='The IDs of the simple application servers.

This parameter is required.'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model ApplyFirewallTemplateResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
  taskId?: string(name='TaskId', description='The ID of the execution to apply the template.', example='aft-ikgt0bynitvs3****'),
}

model ApplyFirewallTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ApplyFirewallTemplateResponseBody(name='body'),
}

/**
 * @summary Uses a firewall template to apply firewall rules to multiple simple application servers at a time. This improves your efficiency of setting firewall rules.
 *
 * @description If the port range, protocol, and source IP address of a firewall rule in a firewall template are the same as the port range, protocol, and source IP address of an existing rule, the new rule overwrites the existing rule regardless of whether the existing rule is enabled or disabled.
 *
 * @param request ApplyFirewallTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ApplyFirewallTemplateResponse
 */
async function applyFirewallTemplateWithOptions(request: ApplyFirewallTemplateRequest, runtime: Util.RuntimeOptions): ApplyFirewallTemplateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.firewallTemplateId)) {
    query['FirewallTemplateId'] = request.firewallTemplateId;
  }
  if (!Util.isUnset(request.instanceIds)) {
    query['InstanceIds'] = request.instanceIds;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ApplyFirewallTemplate',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Uses a firewall template to apply firewall rules to multiple simple application servers at a time. This improves your efficiency of setting firewall rules.
 *
 * @description If the port range, protocol, and source IP address of a firewall rule in a firewall template are the same as the port range, protocol, and source IP address of an existing rule, the new rule overwrites the existing rule regardless of whether the existing rule is enabled or disabled.
 *
 * @param request ApplyFirewallTemplateRequest
 * @return ApplyFirewallTemplateResponse
 */
async function applyFirewallTemplate(request: ApplyFirewallTemplateRequest): ApplyFirewallTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return applyFirewallTemplateWithOptions(request, runtime);
}

model AttachKeyPairRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceIds?: [ string ](name='InstanceIds', description='The IDs of simple application servers. You can specify a maximum of 50 IDs of simple application servers.

This parameter is required.'),
  keyPairName?: string(name='KeyPairName', description='The name of the key pair that you want to bind to the simple application server. The name must be 2 to 64 characters in length and can contain letters, digits, colons (:), underscores (_), and hyphens (-). The name must start with a letter but cannot start with http:// or https://.

This parameter is required.', example='test_gin'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model AttachKeyPairResponseBody = {
  failCount?: int32(name='FailCount', description='The total number of simple application servers to which the key pair failed to be bound.', example='2'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
  results?: [ 
    {
      code?: string(name='Code', description='The HTTP status code.', example='200'),
      instanceId?: string(name='InstanceId', description='The simple application server ID.', example='aa6e71ddb35c46679bc4753d6219d604'),
      message?: string(name='Message', description='The response message.', example='success'),
      success?: string(name='Success', description='Indicates whether the key pair is bound to the simple application server successfully. Valid values:

*   true
*   false', example='true'),
    }
  ](name='Results', description='The request results.'),
  totalCount?: int32(name='TotalCount', description='The total number of simple application servers to which the key pair is bound.', example='2'),
}

model AttachKeyPairResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AttachKeyPairResponseBody(name='body'),
}

/**
 * @summary Binds a key pair to simple application servers.
 *
 * @description You can bind only one key pair to a simple application server in the Simple Application Server console. If a simple application server has a key pair bound, the new key pair overwrites the original key pair.
 *
 * @param request AttachKeyPairRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AttachKeyPairResponse
 */
async function attachKeyPairWithOptions(request: AttachKeyPairRequest, runtime: Util.RuntimeOptions): AttachKeyPairResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceIds)) {
    query['InstanceIds'] = request.instanceIds;
  }
  if (!Util.isUnset(request.keyPairName)) {
    query['KeyPairName'] = request.keyPairName;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AttachKeyPair',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Binds a key pair to simple application servers.
 *
 * @description You can bind only one key pair to a simple application server in the Simple Application Server console. If a simple application server has a key pair bound, the new key pair overwrites the original key pair.
 *
 * @param request AttachKeyPairRequest
 * @return AttachKeyPairResponse
 */
async function attachKeyPair(request: AttachKeyPairRequest): AttachKeyPairResponse {
  var runtime = new Util.RuntimeOptions{};
  return attachKeyPairWithOptions(request, runtime);
}

model CreateCommandRequest {
  commandContent?: string(name='CommandContent', description='The command content. When you specify this parameter, take note of the following items:

*   When `EnableParameter` is set to true, the custom parameter feature is enabled, and you can configure custom parameters in the command based on the following rules:
*   Define custom parameters in the {{}} format. Within `{{}}`, the spaces and line feeds before and after the parameter names are ignored.
*   You can specify up to 20 custom parameters.
*   The name of a custom parameter can contain only letters, digits, underscores (_), and hyphens (-). The name is case-insensitive.
*   The name of a custom parameter cannot exceed 64 bytes in length.

This parameter is required.', example='ifconfig -s'),
  description?: string(name='Description', description='The description of the command. The description supports all character sets and can be up to 512 characters in length.', example='test'),
  enableParameter?: boolean(name='EnableParameter', description='Specifies whether to use custom parameters in the command.

Default value: false.', example='false'),
  name?: string(name='Name', description='The name of the command. The name supports all character sets and can be up to 128 characters in length.

This parameter is required.', example='testName'),
  regionId?: string(name='RegionId', description='The region ID. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-aek2bti7cf7****'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of tag N that you want to add to the command. Valid values of N: 1 to 20.

The tag key cannot be an empty string. The tag key can be up to 64 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.', example='TestKey'),
      value?: string(name='Value', description='The value of tag N that you want to add to the command. Valid values of N: 1 to 20.

The tag value can be an empty string. The tag value can be up to 64 characters in length and cannot contain http:// or https://.', example='TestValue'),
    }
  ](name='Tag', description='The tags that you want to add to the command. You can specify up to 20 tags.'),
  timeout?: long(name='Timeout', description='The timeout period for the command execution on the instance.

If a command execution task times out, Command Assistant forcefully terminates the task process. Valid values: 10 to 86400. Unit: seconds. The period of 86400 seconds is equal to 24 hours.

Default value: 60.', example='60'),
  type?: string(name='Type', description='The language type of the command. Valid values:

*   RunBatScript: batch command, applicable to Windows instances
*   RunPowerShellScript: PowerShell command, applicable to Windows instances
*   RunShellScript: shell command, applicable to Linux instances

This parameter is required.', example='RunShellScript'),
  workingDir?: string(name='WorkingDir', description='The working directory of the command on the ECS instance.

Default values:

*   For a Linux instance, the default value is the home directory of the root user, which is the `/root` directory.
*   For a Windows instance, the default value is the directory where the Cloud Assistant client process resides. Example: `C:\\\\Windows\\\\System32`.', example='/root/'),
}

model CreateCommandResponseBody = {
  commandId?: string(name='CommandId', description='The command ID.', example='c-sh02yh0932w****'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4****'),
}

model CreateCommandResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateCommandResponseBody(name='body'),
}

/**
 * @summary Creates a Cloud Assistant command.
 *
 * @param request CreateCommandRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateCommandResponse
 */
async function createCommandWithOptions(request: CreateCommandRequest, runtime: Util.RuntimeOptions): CreateCommandResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.commandContent)) {
    query['CommandContent'] = request.commandContent;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.enableParameter)) {
    query['EnableParameter'] = request.enableParameter;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  if (!Util.isUnset(request.timeout)) {
    query['Timeout'] = request.timeout;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  if (!Util.isUnset(request.workingDir)) {
    query['WorkingDir'] = request.workingDir;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateCommand',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a Cloud Assistant command.
 *
 * @param request CreateCommandRequest
 * @return CreateCommandResponse
 */
async function createCommand(request: CreateCommandRequest): CreateCommandResponse {
  var runtime = new Util.RuntimeOptions{};
  return createCommandWithOptions(request, runtime);
}

model CreateCustomImageRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  dataSnapshotId?: string(name='DataSnapshotId', description='The ID of the data disk snapshot.', example='s-acscasca****'),
  description?: string(name='Description', description='The description of the custom image.', example='test'),
  imageName?: string(name='ImageName', description='The name of the custom image. The name must be 2 to 128 characters in length, and can contain letters, digits, colons (:), underscores (_), and hyphens (-). The name must start with a letter or a digit. This parameter is empty by default.

This parameter is required.', example='customImage-test'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  regionId?: string(name='RegionId', description='The region ID of the database. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The resource group ID.', example='rg-aek2bti7cf7****'),
  systemSnapshotId?: string(name='SystemSnapshotId', description='The ID of the system disk snapshot.', example='s-acscasca****'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of tag N that you want to add to the custom image. Valid values of N: 1 to 20.

The tag key cannot be an empty string. The tag key can be up to 64 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.', example='TestKey'),
      value?: string(name='Value', description='The value of tag N that you want to add to the custom image. Valid values of N: 1 to 20.

The tag value can be an empty string. The tag value can be up to 64 characters in length and cannot contain http:// or https://.', example='TestValue'),
    }
  ](name='Tag', description='The tags that you want to add to the custom image. You can specify up to 20 tags.'),
}

model CreateCustomImageResponseBody = {
  imageId?: string(name='ImageId', description='The custom image ID.', example='m-csaascsaccscs****'),
  requestId?: string(name='RequestId', description='The request ID.', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3****'),
}

model CreateCustomImageResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateCustomImageResponseBody(name='body'),
}

/**
 * @summary Creates a custom image based on a snapshot of a simple application server.
 *
 * @description A custom image is created from a snapshot of a simple application server. You can use a custom image to create multiple simple application servers that have the same configurations. You can also share custom images to ECS and use the shared images to create ECS instances or replace the OSs of existing ECS instances. For more information about custom images, see [Overview of custom images](https://help.aliyun.com/document_detail/199375.html).
 * You must create a system disk snapshot of a simple application server before you create a custom image based on the snapshot. For more information, see [CreateSnapshot](https://help.aliyun.com/document_detail/190452.html).
 * >  If you need the data on the data disk of a simple application server when you create a custom image, create a snapshot for the data disk first.
 * Before you create a custom image, take note of the following items:
 * *   The custom image and the corresponding simple application server must reside in the same region.
 * *   The maximum number of custom images that you can create is 3 times the number of simple application servers that you have, but cannot exceed 15.
 * *   You can directly create a custom image only based on the system disk snapshot of a simple application server. If you want a custom image to contain the data on the data disk of the simple application server, you must select a data disk snapshot in addition to a system disk snapshot when you create the custom image.
 * *   If a simple application server is released due to expiration or refunds, the custom images that are created based on the server are also released.
 * *   Resetting the system or changing the image of a simple application server clears the disk data on the server. Back up the data as needed.
 *
 * @param request CreateCustomImageRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateCustomImageResponse
 */
async function createCustomImageWithOptions(request: CreateCustomImageRequest, runtime: Util.RuntimeOptions): CreateCustomImageResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.dataSnapshotId)) {
    query['DataSnapshotId'] = request.dataSnapshotId;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.imageName)) {
    query['ImageName'] = request.imageName;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.systemSnapshotId)) {
    query['SystemSnapshotId'] = request.systemSnapshotId;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateCustomImage',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a custom image based on a snapshot of a simple application server.
 *
 * @description A custom image is created from a snapshot of a simple application server. You can use a custom image to create multiple simple application servers that have the same configurations. You can also share custom images to ECS and use the shared images to create ECS instances or replace the OSs of existing ECS instances. For more information about custom images, see [Overview of custom images](https://help.aliyun.com/document_detail/199375.html).
 * You must create a system disk snapshot of a simple application server before you create a custom image based on the snapshot. For more information, see [CreateSnapshot](https://help.aliyun.com/document_detail/190452.html).
 * >  If you need the data on the data disk of a simple application server when you create a custom image, create a snapshot for the data disk first.
 * Before you create a custom image, take note of the following items:
 * *   The custom image and the corresponding simple application server must reside in the same region.
 * *   The maximum number of custom images that you can create is 3 times the number of simple application servers that you have, but cannot exceed 15.
 * *   You can directly create a custom image only based on the system disk snapshot of a simple application server. If you want a custom image to contain the data on the data disk of the simple application server, you must select a data disk snapshot in addition to a system disk snapshot when you create the custom image.
 * *   If a simple application server is released due to expiration or refunds, the custom images that are created based on the server are also released.
 * *   Resetting the system or changing the image of a simple application server clears the disk data on the server. Back up the data as needed.
 *
 * @param request CreateCustomImageRequest
 * @return CreateCustomImageResponse
 */
async function createCustomImage(request: CreateCustomImageRequest): CreateCustomImageResponse {
  var runtime = new Util.RuntimeOptions{};
  return createCustomImageWithOptions(request, runtime);
}

model CreateFirewallRuleRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  port?: string(name='Port', description='The port range.

*   When the transport layer protocol is TCP and/or UDP, the port range is 1 to 65535. Specify a port range in the format of \\\\<start port number>/\\\\<end port number>. Example: 1024/1055, which specifies the port range from 1024 to 1055.
*   When the transport layer protocol is ICMP, the port range is -1/-1, which indicates all ports.

This parameter is required.', example='3306'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server.

This parameter is required.', example='cn-hangzhou'),
  remark?: string(name='Remark', description='The remarks of the firewall rule.', example='TEST'),
  ruleProtocol?: string(name='RuleProtocol', description='The transport layer protocol. Valid values:

*   TCP
*   UDP
*   TCP+UDP
*   ICMP

This parameter is required.', example='TCP'),
}

model CreateFirewallRuleResponseBody = {
  firewallId?: string(name='FirewallId', description='The ID of the firewall rule.', example='8007e18c61024aafbd776d52d0****'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model CreateFirewallRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateFirewallRuleResponseBody(name='body'),
}

/**
 * @summary Creates a firewall rule for a simple application server.
 *
 * @description Firewalls serve to control network access to simple application servers and isolate security domains in the cloud. By default, SSH port 22, HTTP port 80, and HTTPS port 443 are enabled for simple application servers. Other ports are disabled. You can add firewall rules to enable more ports.
 *
 * @param request CreateFirewallRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateFirewallRuleResponse
 */
async function createFirewallRuleWithOptions(request: CreateFirewallRuleRequest, runtime: Util.RuntimeOptions): CreateFirewallRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.port)) {
    query['Port'] = request.port;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.remark)) {
    query['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.ruleProtocol)) {
    query['RuleProtocol'] = request.ruleProtocol;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateFirewallRule',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a firewall rule for a simple application server.
 *
 * @description Firewalls serve to control network access to simple application servers and isolate security domains in the cloud. By default, SSH port 22, HTTP port 80, and HTTPS port 443 are enabled for simple application servers. Other ports are disabled. You can add firewall rules to enable more ports.
 *
 * @param request CreateFirewallRuleRequest
 * @return CreateFirewallRuleResponse
 */
async function createFirewallRule(request: CreateFirewallRuleRequest): CreateFirewallRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return createFirewallRuleWithOptions(request, runtime);
}

model CreateFirewallRulesRequest {
  clientToken?: string(name='ClientToken', description='The client token.', example='123e4567-e89b-12d3-a456-426655440000'),
  firewallRules?: [ 
    {
      port?: string(name='Port', description='The port number.

*   When the transport layer protocol is TCP and/or UDP, the port number range is 1 to 65535. Specify a port range in the format of \\\\<Start port number>/\\\\<End port number>. Example: 1/200.
*   When the transport layer protocol is ICMP, the port number range is -1/-1, which indicates all ports.', example='3306'),
      remark?: string(name='Remark', description='The description of the firewall rule.', example='TEST'),
      ruleProtocol?: string(name='RuleProtocol', description='The transport layer protocol. Valid values:

*   TCP
*   UDP
*   TCP+UDP
*   ICMP', example='TCP'),
      sourceCidrIp?: string(name='SourceCidrIp', description='The IP address or CIDR block that is allowed in the firewall rule.', example='47.101.XX.XX'),
    }
  ](name='FirewallRules', description='Details about the firewall rules.'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key. Valid values of N: 1 to 20.

The tag key cannot be an empty string. The tag key can be up to 64 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.', example='TestKey'),
      value?: string(name='Value', description='The tag value. Valid values of N: 1 to 20.

The tag value can be an empty string. The tag value can be up to 64 characters in length and cannot contain http:// or https://.', example='TestValue'),
    }
  ](name='Tag', description='The tags that you want to add to the firewall. You can specify up to 20 tags.'),
}

model CreateFirewallRulesShrinkRequest {
  clientToken?: string(name='ClientToken', description='The client token.', example='123e4567-e89b-12d3-a456-426655440000'),
  firewallRulesShrink?: string(name='FirewallRules', description='Details about the firewall rules.'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key. Valid values of N: 1 to 20.

The tag key cannot be an empty string. The tag key can be up to 64 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.', example='TestKey'),
      value?: string(name='Value', description='The tag value. Valid values of N: 1 to 20.

The tag value can be an empty string. The tag value can be up to 64 characters in length and cannot contain http:// or https://.', example='TestValue'),
    }
  ](name='Tag', description='The tags that you want to add to the firewall. You can specify up to 20 tags.'),
}

model CreateFirewallRulesResponseBody = {
  firewallRuleIds?: [ string ](name='FirewallRuleIds', description='The IDs of the firewall rules that you created.'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model CreateFirewallRulesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateFirewallRulesResponseBody(name='body'),
}

/**
 * @summary Creates multiple firewall rules for a simple application server at a time.
 *
 * @description Firewalls serve to control network access to simple application servers and isolate security domains in the cloud. By default, SSH port 22, HTTP port 80, and HTTPS port 443 are enabled for simple application servers. Other ports are disabled. You can add firewall rules to enable more ports.
 *
 * @param tmpReq CreateFirewallRulesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateFirewallRulesResponse
 */
async function createFirewallRulesWithOptions(tmpReq: CreateFirewallRulesRequest, runtime: Util.RuntimeOptions): CreateFirewallRulesResponse {
  Util.validateModel(tmpReq);
  var request = new CreateFirewallRulesShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.firewallRules)) {
    request.firewallRulesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.firewallRules, 'FirewallRules', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.firewallRulesShrink)) {
    query['FirewallRules'] = request.firewallRulesShrink;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateFirewallRules',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates multiple firewall rules for a simple application server at a time.
 *
 * @description Firewalls serve to control network access to simple application servers and isolate security domains in the cloud. By default, SSH port 22, HTTP port 80, and HTTPS port 443 are enabled for simple application servers. Other ports are disabled. You can add firewall rules to enable more ports.
 *
 * @param request CreateFirewallRulesRequest
 * @return CreateFirewallRulesResponse
 */
async function createFirewallRules(request: CreateFirewallRulesRequest): CreateFirewallRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  return createFirewallRulesWithOptions(request, runtime);
}

model CreateFirewallTemplateRequest {
  description?: string(name='Description', description='The description of the firewall template.', example='test'),
  firewallRule?: [ 
    {
      port?: string(name='Port', description='The port range. Valid values: 1 to 65535. Specify a port range in the format of \\\\<start port number>/\\\\<end port number>. Example: `1024/1055`, which indicates that the port range of 1024 to 1055.

>  If you set RuleProtocol to ICMP, you must set Port to -1/-1.

This parameter is required.', example='8080'),
      remark?: string(name='Remark', description='The remarks of the firewall rule.'),
      ruleProtocol?: string(name='RuleProtocol', description='The transport layer protocol that the rule supports. Valid values:

*   TCP
*   UDP
*   TCP+UDP
*   ICMP

This parameter is required.', example='TCP'),
      sourceCidrIp?: string(name='SourceCidrIp', description='The source address to which you want to grant access permissions. CIDR blocks and IPv4 addresses are supported.

This parameter is required.', example='223.166.XX.XX'),
    }
  ](name='FirewallRule', description='The details of the firewall rule.'),
  name?: string(name='Name', description='The name of the firewall template.

This parameter is required.', example='testName'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server to which the firewall template belongs. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model CreateFirewallTemplateResponseBody = {
  firewallTemplateId?: string(name='FirewallTemplateId', description='The ID of the firewall template.', example='ft-bcf1a7hrdq717****'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model CreateFirewallTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateFirewallTemplateResponseBody(name='body'),
}

/**
 * @summary Creates a firewall template.
 *
 * @description Simple Application Server supports the firewall template feature that provides multiple firewall rules. You can use a template to add a group of firewall rules to one or more simple application servers at a time. This improves the efficiency of setting firewall rules.
 *
 * @param request CreateFirewallTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateFirewallTemplateResponse
 */
async function createFirewallTemplateWithOptions(request: CreateFirewallTemplateRequest, runtime: Util.RuntimeOptions): CreateFirewallTemplateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.firewallRule)) {
    query['FirewallRule'] = request.firewallRule;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateFirewallTemplate',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a firewall template.
 *
 * @description Simple Application Server supports the firewall template feature that provides multiple firewall rules. You can use a template to add a group of firewall rules to one or more simple application servers at a time. This improves the efficiency of setting firewall rules.
 *
 * @param request CreateFirewallTemplateRequest
 * @return CreateFirewallTemplateResponse
 */
async function createFirewallTemplate(request: CreateFirewallTemplateRequest): CreateFirewallTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return createFirewallTemplateWithOptions(request, runtime);
}

model CreateFirewallTemplateRulesRequest {
  firewallRule?: [ 
    {
      port?: string(name='Port', description='The port range. Valid values: 1 to 65535. Specify a port range in the format of \\\\<start port number>/\\\\<end port number>. Example: `1024/1055`, which indicates that the port range of 1024 to 1055.

>  If you set RuleProtocol to ICMP, you must set Port to -1/-1.

This parameter is required.', example='8080'),
      remark?: string(name='Remark', description='The remarks of the firewall rule.', example='test'),
      ruleProtocol?: string(name='RuleProtocol', description='The transport layer protocol that the rule supports. Valid values:

*   TCP
*   UDP
*   TCP+UDP
*   ICMP

This parameter is required.', example='TCP'),
      sourceCidrIp?: string(name='SourceCidrIp', description='The source address to which you want to grant access permissions. CIDR blocks and IPv4 addresses are supported.

This parameter is required.', example='222.70.XX.XX'),
    }
  ](name='FirewallRule', description='The details of the firewall rule.

This parameter is required.'),
  firewallTemplateId?: string(name='FirewallTemplateId', description='The ID of the firewall template.

This parameter is required.', example='ft-bcf1a7hrdq717****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server to which the firewall template is applied. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model CreateFirewallTemplateRulesResponseBody = {
  firewallTemplateRules?: [ 
    {
      firewallTemplateRuleId?: string(name='FirewallTemplateRuleId', description='The ID of the firewall template rule.', example='ft-bcf1a7hrdq717****'),
      port?: string(name='Port', description='The port range. Valid values: 1 to 65535. Specify a port range in the format of \\\\<start port number>/\\\\<end port number>. Example: `1024/1055`, which indicates that the port range of 1024 to 1055.

>  If you set RuleProtocol to ICMP, you must set Port to -1/-1.', example='8080'),
      remark?: string(name='Remark', description='The remarks of the firewall rule.', example='test'),
      ruleProtocol?: string(name='RuleProtocol', description='The transport layer protocol that the rule supports. Valid values:

*   TCP
*   UDP
*   TCP+UDP
*   ICMP: the ICMP protocol', example='TCP'),
      sourceCidrIp?: string(name='SourceCidrIp', description='The source address to which you want to grant access permissions. CIDR blocks and IPv4 addresses are supported.', example='171.233.XX.XX'),
    }
  ](name='FirewallTemplateRules', description='The firewall template rules.'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model CreateFirewallTemplateRulesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateFirewallTemplateRulesResponseBody(name='body'),
}

/**
 * @summary Adds firewall rules to a firewall template based on your business requirements.
 *
 * @description Adding firewall rules to a firewall template does not affect the firewall rules that have been applied to simple application servers..
 *
 * @param request CreateFirewallTemplateRulesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateFirewallTemplateRulesResponse
 */
async function createFirewallTemplateRulesWithOptions(request: CreateFirewallTemplateRulesRequest, runtime: Util.RuntimeOptions): CreateFirewallTemplateRulesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.firewallRule)) {
    query['FirewallRule'] = request.firewallRule;
  }
  if (!Util.isUnset(request.firewallTemplateId)) {
    query['FirewallTemplateId'] = request.firewallTemplateId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateFirewallTemplateRules',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Adds firewall rules to a firewall template based on your business requirements.
 *
 * @description Adding firewall rules to a firewall template does not affect the firewall rules that have been applied to simple application servers..
 *
 * @param request CreateFirewallTemplateRulesRequest
 * @return CreateFirewallTemplateRulesResponse
 */
async function createFirewallTemplateRules(request: CreateFirewallTemplateRulesRequest): CreateFirewallTemplateRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  return createFirewallTemplateRulesWithOptions(request, runtime);
}

model CreateInstanceKeyPairRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='2ad1ae67295445f598017499dc****'),
  keyPairName?: string(name='KeyPairName', description='The name of the key pair.

This parameter is required.', example='ceshi'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model CreateInstanceKeyPairResponseBody = {
  fingerprint?: string(name='Fingerprint', description='The fingerprint of the key pair.', example='If2K1ItazA4GlKkWCEhdRj8Wd6czAvK9*****'),
  keyPairName?: string(name='KeyPairName', description='The name of the key pair.', example='ceshi'),
  privateKey?: string(name='PrivateKey', description='The private key.', example='***'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model CreateInstanceKeyPairResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateInstanceKeyPairResponseBody(name='body'),
}

/**
 * @summary Creates a key pair for a simple application server.
 *
 * @param request CreateInstanceKeyPairRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateInstanceKeyPairResponse
 */
async function createInstanceKeyPairWithOptions(request: CreateInstanceKeyPairRequest, runtime: Util.RuntimeOptions): CreateInstanceKeyPairResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.keyPairName)) {
    query['KeyPairName'] = request.keyPairName;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateInstanceKeyPair',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a key pair for a simple application server.
 *
 * @param request CreateInstanceKeyPairRequest
 * @return CreateInstanceKeyPairResponse
 */
async function createInstanceKeyPair(request: CreateInstanceKeyPairRequest): CreateInstanceKeyPairResponse {
  var runtime = new Util.RuntimeOptions{};
  return createInstanceKeyPairWithOptions(request, runtime);
}

model CreateInstancesRequest {
  amount?: int32(name='Amount', description='The number of simple application servers that you want to create. Valid values: 1 to 20.

Default value: 1.', example='1'),
  autoRenew?: boolean(name='AutoRenew', description='Specifies whether to enable auto-renewal. Valid values:

*   true
*   false

Default value: false.', example='false'),
  autoRenewPeriod?: int32(name='AutoRenewPeriod', description='The auto-renewal period. This parameter is required only when you set `AutoRenew` to true. Unit: month. Valid values: 1, 3, 6, 12, 24, and 36.', example='1'),
  chargeType?: string(name='ChargeType', description='The billing method of the simple application servers. Set the value to PrePaid, which indicates the subscription billing method.

Default value: PrePaid.', example='PrePaid'),
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  dataDiskSize?: long(name='DataDiskSize', description='The size of the data disk that is attached to the server. Unit: GB. Valid values: 0 to 16380. The value must be an integral multiple of 20.

*   A value of 0 indicates that no data disk is attached.
*   If the disk included in the specified plan is a standard SSD, the data disk must be 20 GB or larger in size.

Default value: 0.', example='20'),
  imageId?: string(name='ImageId', description='The image ID. You can call the [ListImages](https://help.aliyun.com/document_detail/189313.html) operation to query the available images in the specified region.

This parameter is required.', example='e2c9c365024a44369c9b955a998a****'),
  period?: int32(name='Period', description='The subscription period of the servers. Unit: months. Valid values: 1, 3, 6, 12, 24, and 36.

This parameter is required.', example='1'),
  planId?: string(name='PlanId', description='The plan ID. You can call the [ListPlans](https://help.aliyun.com/document_detail/189314.html) operation to query all plans provided by Simple Application Server in the specified region.

This parameter is required.', example='swas.s1.c1m1s40b3t05'),
  regionId?: string(name='RegionId', description='The region ID of the simple application servers. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model CreateInstancesResponseBody = {
  instanceIds?: [ string ](name='InstanceIds', description='The IDs of the simple application servers.'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E1FEE'),
}

model CreateInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateInstancesResponseBody(name='body'),
}

/**
 * @summary Creates subscription simple application servers.
 *
 * @description *   Before you call this operation, we recommend that you understand the billing rules of Simple Application Server. For more information, see [Billable items](https://help.aliyun.com/document_detail/58623.html).
 * >  If you have coupons in your Alibaba Cloud account, the coupons are preferentially used to pay for the simple application servers.
 * *   You can create a maximum of 50 simple application servers in a region for an Alibaba Cloud account.
 * *   When you call this operation to create simple application servers, make sure that the balance in your account is sufficient to pay for the servers. If the balance in your account is insufficient, the servers cannot be created.
 *
 * @param request CreateInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateInstancesResponse
 */
async function createInstancesWithOptions(request: CreateInstancesRequest, runtime: Util.RuntimeOptions): CreateInstancesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.amount)) {
    query['Amount'] = request.amount;
  }
  if (!Util.isUnset(request.autoRenew)) {
    query['AutoRenew'] = request.autoRenew;
  }
  if (!Util.isUnset(request.autoRenewPeriod)) {
    query['AutoRenewPeriod'] = request.autoRenewPeriod;
  }
  if (!Util.isUnset(request.chargeType)) {
    query['ChargeType'] = request.chargeType;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.dataDiskSize)) {
    query['DataDiskSize'] = request.dataDiskSize;
  }
  if (!Util.isUnset(request.imageId)) {
    query['ImageId'] = request.imageId;
  }
  if (!Util.isUnset(request.period)) {
    query['Period'] = request.period;
  }
  if (!Util.isUnset(request.planId)) {
    query['PlanId'] = request.planId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateInstances',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates subscription simple application servers.
 *
 * @description *   Before you call this operation, we recommend that you understand the billing rules of Simple Application Server. For more information, see [Billable items](https://help.aliyun.com/document_detail/58623.html).
 * >  If you have coupons in your Alibaba Cloud account, the coupons are preferentially used to pay for the simple application servers.
 * *   You can create a maximum of 50 simple application servers in a region for an Alibaba Cloud account.
 * *   When you call this operation to create simple application servers, make sure that the balance in your account is sufficient to pay for the servers. If the balance in your account is insufficient, the servers cannot be created.
 *
 * @param request CreateInstancesRequest
 * @return CreateInstancesResponse
 */
async function createInstances(request: CreateInstancesRequest): CreateInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return createInstancesWithOptions(request, runtime);
}

model CreateKeyPairRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  keyPairName?: string(name='KeyPairName', description='The name of the key pair. The name must be 2 to 64 characters in length and can contain letters, digits, colons (.), underscores (_), and hyphens (-). It must start with a letter but cannot start with http:// or https://.

This parameter is required.', example='KeyPairName'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model CreateKeyPairResponseBody = {
  keyPairName?: string(name='KeyPairName', description='The name of the key pair. The name must be 2 to 64 characters in length and can contain letters, digits, colons (.), underscores (_), and hyphens (-). It must start with a letter but cannot start with http:// or https://.', example='KeyPairName'),
  privateKeyBody?: string(name='PrivateKeyBody', description='The private key of the key pair. The PEM-encoded private key is in PKCS#8 format.', example='MIIEpAIBAAKCAQEAtReyMzLIcBH78EV2zj****'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
}

model CreateKeyPairResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateKeyPairResponseBody(name='body'),
}

/**
 * @summary Creates a key pair.
 *
 * @description Alibaba Cloud SSH key pairs offer a secure and efficient logon authentication mechanism, facilitating both verification and encrypted communication within the SSH protocol framework. An SSH key pair is essentially constituted by a public key and a private key. Tailored for Linux-based simple application servers, this security measure enhances security and convenience, effectively addressing your heightened security requirements.
 * *   The key pair logon method is only valid for Linux-based simple application servers.
 * *   A maximum of 10 key pairs can be created in a region for an Alibaba Cloud account.
 * *   Only RSA 2048-bit key pairs can be created in the Simple Application Server console.
 *
 * @param request CreateKeyPairRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateKeyPairResponse
 */
async function createKeyPairWithOptions(request: CreateKeyPairRequest, runtime: Util.RuntimeOptions): CreateKeyPairResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.keyPairName)) {
    query['KeyPairName'] = request.keyPairName;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateKeyPair',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a key pair.
 *
 * @description Alibaba Cloud SSH key pairs offer a secure and efficient logon authentication mechanism, facilitating both verification and encrypted communication within the SSH protocol framework. An SSH key pair is essentially constituted by a public key and a private key. Tailored for Linux-based simple application servers, this security measure enhances security and convenience, effectively addressing your heightened security requirements.
 * *   The key pair logon method is only valid for Linux-based simple application servers.
 * *   A maximum of 10 key pairs can be created in a region for an Alibaba Cloud account.
 * *   Only RSA 2048-bit key pairs can be created in the Simple Application Server console.
 *
 * @param request CreateKeyPairRequest
 * @return CreateKeyPairResponse
 */
async function createKeyPair(request: CreateKeyPairRequest): CreateKeyPairResponse {
  var runtime = new Util.RuntimeOptions{};
  return createKeyPairWithOptions(request, runtime);
}

model CreateSnapshotRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  diskId?: string(name='DiskId', description='The disk ID.

This parameter is required.', example='d-bp18kjxg9ebrhsgi****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server to which the disk is attached.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-aek2bti7cf7****'),
  snapshotName?: string(name='SnapshotName', description='The snapshot name. The name must be 2 to 50 characters in length. It must start with a letter but cannot start with `http://` or `https://`. The name can only contain letters, digits, colons (:), underscores (_), periods (.), and hyphens (-).

This parameter is required.', example='test-SnapshotName'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of the tag to add to the snapshot. Valid values of N: 1 to 20.

The tag key cannot be an empty string. The tag key can be up to 64 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.', example='TestKey'),
      value?: string(name='Value', description='The value of the tag to add to the snapshot. Valid values of N: 1 to 20.

The tag value can be an empty string. The tag value can be up to 64 characters in length and cannot contain http:// or https://.', example='TestValue'),
    }
  ](name='Tag', description='The tags that you want to add to the snapshot. You can specify up to 20 tags.'),
}

model CreateSnapshotResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
  snapshotId?: string(name='SnapshotId', description='The snapshot ID.', example='s-bp16oazlsold4dks****'),
}

model CreateSnapshotResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateSnapshotResponseBody(name='body'),
}

/**
 * @summary Creates a snapshot for a disk.
 *
 * @description A snapshot is a point-in-time backup of a disk. Snapshots can be used to back up data, recover data after misoperations on servers, recover data after network attacks, and create custom images.
 * >  You are not charged for creating snapshots in Simple Application Server.
 * ### [](#)Precautions
 * *   You can create up to three snapshots for each simple application server.
 * *   The maximum number of snapshots that you create per Alibaba Cloud account is triple of the number of simple application servers that are created. The value cannot be greater than 15.
 * *   If a simple application server is automatically released due to expiration, the snapshots created for the server are deleted.
 * *   If you reset a simple application server after you create a snapshot for the server, the snapshot is retained but cannot be used to restore the disks of the server.
 *
 * @param request CreateSnapshotRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateSnapshotResponse
 */
async function createSnapshotWithOptions(request: CreateSnapshotRequest, runtime: Util.RuntimeOptions): CreateSnapshotResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.diskId)) {
    query['DiskId'] = request.diskId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.snapshotName)) {
    query['SnapshotName'] = request.snapshotName;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateSnapshot',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a snapshot for a disk.
 *
 * @description A snapshot is a point-in-time backup of a disk. Snapshots can be used to back up data, recover data after misoperations on servers, recover data after network attacks, and create custom images.
 * >  You are not charged for creating snapshots in Simple Application Server.
 * ### [](#)Precautions
 * *   You can create up to three snapshots for each simple application server.
 * *   The maximum number of snapshots that you create per Alibaba Cloud account is triple of the number of simple application servers that are created. The value cannot be greater than 15.
 * *   If a simple application server is automatically released due to expiration, the snapshots created for the server are deleted.
 * *   If you reset a simple application server after you create a snapshot for the server, the snapshot is retained but cannot be used to restore the disks of the server.
 *
 * @param request CreateSnapshotRequest
 * @return CreateSnapshotResponse
 */
async function createSnapshot(request: CreateSnapshotRequest): CreateSnapshotResponse {
  var runtime = new Util.RuntimeOptions{};
  return createSnapshotWithOptions(request, runtime);
}

model DeleteCommandRequest {
  commandId?: string(name='CommandId', description='The command ID. You can call the [DescribeCommands](https://help.aliyun.com/document_detail/64843.html) operation to query all available command IDs.

This parameter is required.', example='c-sh02yh0932w****'),
  regionId?: string(name='RegionId', description='The region ID. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DeleteCommandResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model DeleteCommandResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteCommandResponseBody(name='body'),
}

/**
 * @summary Deletes a Command Assistant command.
 *
 * @description You cannot delete commands that are being run.
 *
 * @param request DeleteCommandRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteCommandResponse
 */
async function deleteCommandWithOptions(request: DeleteCommandRequest, runtime: Util.RuntimeOptions): DeleteCommandResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.commandId)) {
    query['CommandId'] = request.commandId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteCommand',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a Command Assistant command.
 *
 * @description You cannot delete commands that are being run.
 *
 * @param request DeleteCommandRequest
 * @return DeleteCommandResponse
 */
async function deleteCommand(request: DeleteCommandRequest): DeleteCommandResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteCommandWithOptions(request, runtime);
}

model DeleteCustomImageRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  imageId?: string(name='ImageId', description='The custom image ID.

This parameter is required.', example='m-2zehv38jjmwva1ee****'),
  regionId?: string(name='RegionId', description='The region ID of the custom image. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DeleteCustomImageResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model DeleteCustomImageResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteCustomImageResponseBody(name='body'),
}

/**
 * @summary Deletes a custom image.
 *
 * @description You can delete a custom image that you no longer need. After the custom image is deleted, you cannot use the custom image to reset the simple application servers that were created based on the custom image.
 * >  To delete a shared image, you must unshare the image before you can delete it. After a custom image is unshared, you cannot query the custom image by using the Elastic Compute Service (ECS) console or API. If you want to use a custom image to create ECS instances, we recommend that you copy the custom image before you delete it. For more information, see [Copy a shared image of a simple application server in the ECS console](https://help.aliyun.com/document_detail/199378.html).
 *
 * @param request DeleteCustomImageRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteCustomImageResponse
 */
async function deleteCustomImageWithOptions(request: DeleteCustomImageRequest, runtime: Util.RuntimeOptions): DeleteCustomImageResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.imageId)) {
    query['ImageId'] = request.imageId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteCustomImage',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a custom image.
 *
 * @description You can delete a custom image that you no longer need. After the custom image is deleted, you cannot use the custom image to reset the simple application servers that were created based on the custom image.
 * >  To delete a shared image, you must unshare the image before you can delete it. After a custom image is unshared, you cannot query the custom image by using the Elastic Compute Service (ECS) console or API. If you want to use a custom image to create ECS instances, we recommend that you copy the custom image before you delete it. For more information, see [Copy a shared image of a simple application server in the ECS console](https://help.aliyun.com/document_detail/199378.html).
 *
 * @param request DeleteCustomImageRequest
 * @return DeleteCustomImageResponse
 */
async function deleteCustomImage(request: DeleteCustomImageRequest): DeleteCustomImageResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteCustomImageWithOptions(request, runtime);
}

model DeleteCustomImagesRequest {
  clientToken?: string(name='ClientToken', description='The client token that you want to use to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [Ensure idempotence](https://help.aliyun.com/document_detail/25693.html)', example='123e4567-e89b-12d3-a456-426655440000'),
  imageIds?: string(name='ImageIds', description='The ID of the custom image. The value can be a JSON array that consists of up to 15 image IDs. Separate multiple image IDs with commas (,).

This parameter is required.', example='["m-2zehv38jjmwva1ee****", "m-bp1hj0zhmheyq2kz****"]'),
  regionId?: string(name='RegionId', description='The region ID. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DeleteCustomImagesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model DeleteCustomImagesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteCustomImagesResponseBody(name='body'),
}

/**
 * @summary Deletes custom images. If you no longer require a custom image, you can call this operation to delete the custom image. You can also call this operation to delete multiple custom images at the same time. After a custom image is deleted, you cannot use the custom image to reset the simple application servers that were created based on the custom image.
 *
 * @description If a custom image is shared, you must unshare the image before you can delete it. After a custom image is unshared, you cannot query the custom image by using the Elastic Compute Service (ECS) console or by calling an ECS API operation. If you want to use a custom image to create ECS instances, we recommend that you copy the custom image before you delete it. For more information, see [Copy a custom image](https://help.aliyun.com/document_detail/199378.html).
 *
 * @param request DeleteCustomImagesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteCustomImagesResponse
 */
async function deleteCustomImagesWithOptions(request: DeleteCustomImagesRequest, runtime: Util.RuntimeOptions): DeleteCustomImagesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.imageIds)) {
    query['ImageIds'] = request.imageIds;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteCustomImages',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes custom images. If you no longer require a custom image, you can call this operation to delete the custom image. You can also call this operation to delete multiple custom images at the same time. After a custom image is deleted, you cannot use the custom image to reset the simple application servers that were created based on the custom image.
 *
 * @description If a custom image is shared, you must unshare the image before you can delete it. After a custom image is unshared, you cannot query the custom image by using the Elastic Compute Service (ECS) console or by calling an ECS API operation. If you want to use a custom image to create ECS instances, we recommend that you copy the custom image before you delete it. For more information, see [Copy a custom image](https://help.aliyun.com/document_detail/199378.html).
 *
 * @param request DeleteCustomImagesRequest
 * @return DeleteCustomImagesResponse
 */
async function deleteCustomImages(request: DeleteCustomImagesRequest): DeleteCustomImagesResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteCustomImagesWithOptions(request, runtime);
}

model DeleteFirewallRuleRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server.

This parameter is required.', example='cn-hangzhou'),
  ruleId?: string(name='RuleId', description='The ID of the firewall rule.

This parameter is required.', example='eeea34d9867b4d55a4ff8d5fcfbd****'),
}

model DeleteFirewallRuleResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model DeleteFirewallRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteFirewallRuleResponseBody(name='body'),
}

/**
 * @summary Deletes a firewall rule of a simple application server.
 *
 * @description After a firewall rule is deleted, your business deployed on the simple application server may become inaccessible. Before you delete a firewall rule, make sure that the firewall rule is no longer needed by the simple application server.
 *
 * @param request DeleteFirewallRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteFirewallRuleResponse
 */
async function deleteFirewallRuleWithOptions(request: DeleteFirewallRuleRequest, runtime: Util.RuntimeOptions): DeleteFirewallRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteFirewallRule',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a firewall rule of a simple application server.
 *
 * @description After a firewall rule is deleted, your business deployed on the simple application server may become inaccessible. Before you delete a firewall rule, make sure that the firewall rule is no longer needed by the simple application server.
 *
 * @param request DeleteFirewallRuleRequest
 * @return DeleteFirewallRuleResponse
 */
async function deleteFirewallRule(request: DeleteFirewallRuleRequest): DeleteFirewallRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteFirewallRuleWithOptions(request, runtime);
}

model DeleteFirewallRulesRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='2ad1ae67295445f598017499dc****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  ruleIds?: [ string ](name='RuleIds', description='The IDs of the firewall rules that you want to delete.'),
}

model DeleteFirewallRulesShrinkRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='2ad1ae67295445f598017499dc****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  ruleIdsShrink?: string(name='RuleIds', description='The IDs of the firewall rules that you want to delete.'),
}

model DeleteFirewallRulesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model DeleteFirewallRulesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteFirewallRulesResponseBody(name='body'),
}

/**
 * @summary Deletes multiple firewall rules of a simple application server.
 *
 * @description After a firewall rule is deleted, your business deployed on the simple application server may become inaccessible. Before you delete a firewall rule, make sure that the firewall rule is no longer needed by the simple application server.
 *
 * @param tmpReq DeleteFirewallRulesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteFirewallRulesResponse
 */
async function deleteFirewallRulesWithOptions(tmpReq: DeleteFirewallRulesRequest, runtime: Util.RuntimeOptions): DeleteFirewallRulesResponse {
  Util.validateModel(tmpReq);
  var request = new DeleteFirewallRulesShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.ruleIds)) {
    request.ruleIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.ruleIds, 'RuleIds', 'simple');
  }
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.ruleIdsShrink)) {
    query['RuleIds'] = request.ruleIdsShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteFirewallRules',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes multiple firewall rules of a simple application server.
 *
 * @description After a firewall rule is deleted, your business deployed on the simple application server may become inaccessible. Before you delete a firewall rule, make sure that the firewall rule is no longer needed by the simple application server.
 *
 * @param request DeleteFirewallRulesRequest
 * @return DeleteFirewallRulesResponse
 */
async function deleteFirewallRules(request: DeleteFirewallRulesRequest): DeleteFirewallRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteFirewallRulesWithOptions(request, runtime);
}

model DeleteFirewallTemplateRulesRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  firewallTemplateId?: string(name='FirewallTemplateId', description='The ID of the firewall template.

This parameter is required.', example='ft-bcf1a7hrdq717****'),
  firewallTemplateRuleId?: [ string ](name='FirewallTemplateRuleId', description='The IDs of the firewall template rules.

This parameter is required.'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DeleteFirewallTemplateRulesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model DeleteFirewallTemplateRulesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteFirewallTemplateRulesResponseBody(name='body'),
}

/**
 * @summary Deletes firewall rules from a firewall template based on your requirements.
 *
 * @description Deletion of firewall rules does not affect the firewall rules that have been applied to simple application servers.
 *
 * @param request DeleteFirewallTemplateRulesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteFirewallTemplateRulesResponse
 */
async function deleteFirewallTemplateRulesWithOptions(request: DeleteFirewallTemplateRulesRequest, runtime: Util.RuntimeOptions): DeleteFirewallTemplateRulesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.firewallTemplateId)) {
    query['FirewallTemplateId'] = request.firewallTemplateId;
  }
  if (!Util.isUnset(request.firewallTemplateRuleId)) {
    query['FirewallTemplateRuleId'] = request.firewallTemplateRuleId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteFirewallTemplateRules',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes firewall rules from a firewall template based on your requirements.
 *
 * @description Deletion of firewall rules does not affect the firewall rules that have been applied to simple application servers.
 *
 * @param request DeleteFirewallTemplateRulesRequest
 * @return DeleteFirewallTemplateRulesResponse
 */
async function deleteFirewallTemplateRules(request: DeleteFirewallTemplateRulesRequest): DeleteFirewallTemplateRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteFirewallTemplateRulesWithOptions(request, runtime);
}

model DeleteFirewallTemplatesRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  firewallTemplateId?: [ string ](name='FirewallTemplateId', description='The IDs of the firewall templates.

This parameter is required.'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DeleteFirewallTemplatesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4****'),
}

model DeleteFirewallTemplatesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteFirewallTemplatesResponseBody(name='body'),
}

/**
 * @summary Deletes firewall templates from a simple application server.
 *
 * @description Deleting a firewall template does not affect the firewall rules that have been applied to simple application servers. You can delete firewall templates that you no longer need.
 *
 * @param request DeleteFirewallTemplatesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteFirewallTemplatesResponse
 */
async function deleteFirewallTemplatesWithOptions(request: DeleteFirewallTemplatesRequest, runtime: Util.RuntimeOptions): DeleteFirewallTemplatesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.firewallTemplateId)) {
    query['FirewallTemplateId'] = request.firewallTemplateId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteFirewallTemplates',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes firewall templates from a simple application server.
 *
 * @description Deleting a firewall template does not affect the firewall rules that have been applied to simple application servers. You can delete firewall templates that you no longer need.
 *
 * @param request DeleteFirewallTemplatesRequest
 * @return DeleteFirewallTemplatesResponse
 */
async function deleteFirewallTemplates(request: DeleteFirewallTemplatesRequest): DeleteFirewallTemplatesResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteFirewallTemplatesWithOptions(request, runtime);
}

model DeleteInstanceKeyPairRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DeleteInstanceKeyPairResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model DeleteInstanceKeyPairResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteInstanceKeyPairResponseBody(name='body'),
}

/**
 * @summary Deletes the key pair of a simple application server.
 *
 * @param request DeleteInstanceKeyPairRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteInstanceKeyPairResponse
 */
async function deleteInstanceKeyPairWithOptions(request: DeleteInstanceKeyPairRequest, runtime: Util.RuntimeOptions): DeleteInstanceKeyPairResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteInstanceKeyPair',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes the key pair of a simple application server.
 *
 * @param request DeleteInstanceKeyPairRequest
 * @return DeleteInstanceKeyPairResponse
 */
async function deleteInstanceKeyPair(request: DeleteInstanceKeyPairRequest): DeleteInstanceKeyPairResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteInstanceKeyPairWithOptions(request, runtime);
}

model DeleteKeyPairsRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  keyPairNames?: [ string ](name='KeyPairNames', description='The names of the SSH key pairs. The name must be 2 to 64 characters in length and can contain letters, digits, colons (:), underscores (_), and hyphens (-). The name must start with a letter and cannot start with http:// or https://. You can specify the names of a maximum of 50 SSH key pairs.

This parameter is required.'),
  regionId?: string(name='RegionId', description='The region ID of the simple application servers. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DeleteKeyPairsResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model DeleteKeyPairsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteKeyPairsResponseBody(name='body'),
}

/**
 * @summary Deletes the SSH key pairs of simple application servers.
 *
 * @description You must unbind SSH key pairs that you no longer use from simple application servers before you delete the SSH key pairs.
 *
 * @param request DeleteKeyPairsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteKeyPairsResponse
 */
async function deleteKeyPairsWithOptions(request: DeleteKeyPairsRequest, runtime: Util.RuntimeOptions): DeleteKeyPairsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.keyPairNames)) {
    query['KeyPairNames'] = request.keyPairNames;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteKeyPairs',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes the SSH key pairs of simple application servers.
 *
 * @description You must unbind SSH key pairs that you no longer use from simple application servers before you delete the SSH key pairs.
 *
 * @param request DeleteKeyPairsRequest
 * @return DeleteKeyPairsResponse
 */
async function deleteKeyPairs(request: DeleteKeyPairsRequest): DeleteKeyPairsResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteKeyPairsWithOptions(request, runtime);
}

model DeleteSnapshotRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  regionId?: string(name='RegionId', description='The region ID of the snapshot.

This parameter is required.', example='cn-hangzhou'),
  snapshotId?: string(name='SnapshotId', description='The snapshot ID.

This parameter is required.', example='s-bp16oazlsold4dks****'),
}

model DeleteSnapshotResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model DeleteSnapshotResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteSnapshotResponseBody(name='body'),
}

/**
 * @summary Deletes a snapshot of a simple application server.
 *
 * @description You can delete a snapshot if you no longer need it.
 * >  If a custom image was created from the snapshot, delete the custom image before you delete the snapshot.
 *
 * @param request DeleteSnapshotRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteSnapshotResponse
 */
async function deleteSnapshotWithOptions(request: DeleteSnapshotRequest, runtime: Util.RuntimeOptions): DeleteSnapshotResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.snapshotId)) {
    query['SnapshotId'] = request.snapshotId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteSnapshot',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes a snapshot of a simple application server.
 *
 * @description You can delete a snapshot if you no longer need it.
 * >  If a custom image was created from the snapshot, delete the custom image before you delete the snapshot.
 *
 * @param request DeleteSnapshotRequest
 * @return DeleteSnapshotResponse
 */
async function deleteSnapshot(request: DeleteSnapshotRequest): DeleteSnapshotResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteSnapshotWithOptions(request, runtime);
}

model DeleteSnapshotsRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  snapshotIds?: string(name='SnapshotIds', description='The snapshot IDs. The value can be a JSON array that consists of up to 100 snapshot IDs. Separate multiple snapshot IDs with commas (,).

This parameter is required.', example='["s-bp16oazlsold4dks****", "s-bp16oazlsold4abc****"]'),
}

model DeleteSnapshotsResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='C2DE174B-7196-5778-A00D-6EA2601B****'),
}

model DeleteSnapshotsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteSnapshotsResponseBody(name='body'),
}

/**
 * @summary Deletes snapshots of a simple application server.
 *
 * @param request DeleteSnapshotsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteSnapshotsResponse
 */
async function deleteSnapshotsWithOptions(request: DeleteSnapshotsRequest, runtime: Util.RuntimeOptions): DeleteSnapshotsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.snapshotIds)) {
    query['SnapshotIds'] = request.snapshotIds;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteSnapshots',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Deletes snapshots of a simple application server.
 *
 * @param request DeleteSnapshotsRequest
 * @return DeleteSnapshotsResponse
 */
async function deleteSnapshots(request: DeleteSnapshotsRequest): DeleteSnapshotsResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteSnapshotsWithOptions(request, runtime);
}

model DescribeCloudAssistantAttributesRequest {
  instanceIds?: [ string ](name='InstanceIds', description='The IDs of the simple application servers.

This parameter is required.'),
  pageNumber?: int32(name='PageNumber', description='The page number.

Pages start from page 1.

Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the specified simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeCloudAssistantAttributesShrinkRequest {
  instanceIdsShrink?: string(name='InstanceIds', description='The IDs of the simple application servers.

This parameter is required.'),
  pageNumber?: int32(name='PageNumber', description='The page number.

Pages start from page 1.

Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the specified simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeCloudAssistantAttributesResponseBody = {
  cloudAssistant?: [ 
    {
      activeTaskCount?: long(name='ActiveTaskCount', description='The number of active tasks in Command Assistant.', example='0'),
      cloudAssistantStatus?: string(name='CloudAssistantStatus', description='Indicates whether Command Assistant is running. Valid values:

true: Heartbeats are detected in the last 2 minutes.

false: Heartbeats are not detected in the last 2 minutes.', example='true'),
      cloudAssistantVersion?: string(name='CloudAssistantVersion', description='The version number of the Command Assistant agent. Null is returned if the Command Assistant agent is not installed or is not running.', example='2.2.0.106'),
      instanceId?: string(name='InstanceId', description='The ID of the simple application server.', example='85dbe3e7cc7b49e1a3df4af3bfa4ebbf'),
      invocationCount?: long(name='InvocationCount', description='The number of completed tasks in Command Assistant.', example='4'),
      lastHeartbeatTime?: string(name='LastHeartbeatTime', description='The time when the last heartbeat of Command Assistant was detected. The value is updated every minute on average. The interval can be 55, 60, or 65 seconds.', example='2021-03-15T09:00:00Z'),
      lastInvokedTime?: string(name='LastInvokedTime', description='The time when commands were last run.', example='2021-03-15T08:00:00Z'),
      OSType?: string(name='OSType', description='The OS type of the simple application server. Valid values:

*   Windows
*   Linux
*   FreeBSD', example='Linux'),
      supportSessionManager?: boolean(name='SupportSessionManager', description='Indicates whether Command Assistant supports session management. If Command Assistant does not support session management, the version of the Command Assistant agent is too earlier. We recommend that you update your Command Assistant agent to the latest version.

To use the session management feature, you must make sure that the version of your Command Assistant agent meets one of the following requirements:

If your simple application server runs Linux, the version of the Command Assistant agent on the server must be 2.2.3.189 or later. If your simple application server runs Windows, the version of the Command Assistant agent on the server must be 2.1.3.189 or later.', example='true'),
    }
  ](name='CloudAssistant', description='The Command Assistant information.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
  totalCount?: int32(name='TotalCount', description='The total number of entries.', example='4'),
}

model DescribeCloudAssistantAttributesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCloudAssistantAttributesResponseBody(name='body'),
}

/**
 * @summary Queries the Command Assistant information of simple application servers.
 *
 * @param tmpReq DescribeCloudAssistantAttributesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCloudAssistantAttributesResponse
 */
async function describeCloudAssistantAttributesWithOptions(tmpReq: DescribeCloudAssistantAttributesRequest, runtime: Util.RuntimeOptions): DescribeCloudAssistantAttributesResponse {
  Util.validateModel(tmpReq);
  var request = new DescribeCloudAssistantAttributesShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.instanceIds)) {
    request.instanceIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.instanceIds, 'InstanceIds', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.instanceIdsShrink)) {
    query['InstanceIds'] = request.instanceIdsShrink;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeCloudAssistantAttributes',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the Command Assistant information of simple application servers.
 *
 * @param request DescribeCloudAssistantAttributesRequest
 * @return DescribeCloudAssistantAttributesResponse
 */
async function describeCloudAssistantAttributes(request: DescribeCloudAssistantAttributesRequest): DescribeCloudAssistantAttributesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeCloudAssistantAttributesWithOptions(request, runtime);
}

model DescribeCloudAssistantStatusRequest {
  instanceIds?: [ string ](name='InstanceIds', description='The IDs of the simple application servers.'),
  pageNumber?: int32(name='PageNumber', description='The page number.

Pages start from page 1.

Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.

Maximum value: 50.

Default value: 10.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the simple application servers.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeCloudAssistantStatusShrinkRequest {
  instanceIdsShrink?: string(name='InstanceIds', description='The IDs of the simple application servers.'),
  pageNumber?: int32(name='PageNumber', description='The page number.

Pages start from page 1.

Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.

Maximum value: 50.

Default value: 10.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the simple application servers.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeCloudAssistantStatusResponseBody = {
  cloudAssistantStatus?: [ 
    {
      instanceId?: string(name='InstanceId', description='The ID of the simple application server.', example='ace0706b2ac4454d984295a94213****'),
      status?: boolean(name='Status', description='Indicates whether the Cloud Assistant client is installed on the server.', example='true'),
    }
  ](name='CloudAssistantStatus', description='Indicates whether the Cloud Assistant client is installed on the server.'),
  pageNumber?: int32(name='PageNumber', description='The page number.

Pages start from page 1.

Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.

Maximum value: 50.

Default value: 10.', example='10'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='1'),
}

model DescribeCloudAssistantStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCloudAssistantStatusResponseBody(name='body'),
}

/**
 * @summary Queries whether the Cloud Assistant client is installed on simple application servers.
 *
 * @description By default, the Cloud Assistant client is installed on simple application servers. If you have manually uninstalled the client, you must reinstall the client. Otherwise, you cannot run commands on the servers.
 *
 * @param tmpReq DescribeCloudAssistantStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCloudAssistantStatusResponse
 */
async function describeCloudAssistantStatusWithOptions(tmpReq: DescribeCloudAssistantStatusRequest, runtime: Util.RuntimeOptions): DescribeCloudAssistantStatusResponse {
  Util.validateModel(tmpReq);
  var request = new DescribeCloudAssistantStatusShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.instanceIds)) {
    request.instanceIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.instanceIds, 'InstanceIds', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.instanceIdsShrink)) {
    query['InstanceIds'] = request.instanceIdsShrink;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeCloudAssistantStatus',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries whether the Cloud Assistant client is installed on simple application servers.
 *
 * @description By default, the Cloud Assistant client is installed on simple application servers. If you have manually uninstalled the client, you must reinstall the client. Otherwise, you cannot run commands on the servers.
 *
 * @param request DescribeCloudAssistantStatusRequest
 * @return DescribeCloudAssistantStatusResponse
 */
async function describeCloudAssistantStatus(request: DescribeCloudAssistantStatusRequest): DescribeCloudAssistantStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeCloudAssistantStatusWithOptions(request, runtime);
}

model DescribeCloudMonitorAgentStatusesRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceIds?: string(name='InstanceIds', description='The IDs of the simple application servers. The value can be a JSON array that consists of up to 100 simple application server IDs. Separate multiple server IDs with commas (,).

This parameter is required.', example='["2ad1ae67295445f598017499dc******","2ad1ae67295445f598017499dc******"]'),
  regionId?: string(name='RegionId', description='The region ID of the simple application servers. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeCloudMonitorAgentStatusesResponseBody = {
  instanceStatusList?: [ 
    {
      autoInstall?: boolean(name='AutoInstall', description='Indicates whether the Cloud Monitor agent was automatically installed on the simple application server. Valid values:

- true
- false', example='true'),
      instanceId?: string(name='InstanceId', description='The ID of the simple application server.', example='c854dc6f07e74953830bb5808d0****'),
      status?: string(name='Status', description='The running status of the Cloud Monitoring plug-in. Possible values are:

- running: Cloud Monitoring plug-in running.
- stopped: Cloud Monitoring plug-in stopped.
- installing: Cloud Monitoring plug-in installing.
- install_faild: Cloud Monitoring plug-in installation failed.
- abnormal: Cloud Monitoring plug-in installation abnormal.
- not_installed: Cloud Monitoring plug-in not installed.', example='running'),
    }
  ](name='InstanceStatusList', description='Indicates whether the Cloud Monitor agent was automatically installed on the simple application server.'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E1FEE'),
}

model DescribeCloudMonitorAgentStatusesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCloudMonitorAgentStatusesResponseBody(name='body'),
}

/**
 * @summary Queries the status of the CloudMonitor agent on simple application servers.
 *
 * @param request DescribeCloudMonitorAgentStatusesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCloudMonitorAgentStatusesResponse
 */
async function describeCloudMonitorAgentStatusesWithOptions(request: DescribeCloudMonitorAgentStatusesRequest, runtime: Util.RuntimeOptions): DescribeCloudMonitorAgentStatusesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceIds)) {
    query['InstanceIds'] = request.instanceIds;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeCloudMonitorAgentStatuses',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the status of the CloudMonitor agent on simple application servers.
 *
 * @param request DescribeCloudMonitorAgentStatusesRequest
 * @return DescribeCloudMonitorAgentStatusesResponse
 */
async function describeCloudMonitorAgentStatuses(request: DescribeCloudMonitorAgentStatusesRequest): DescribeCloudMonitorAgentStatusesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeCloudMonitorAgentStatusesWithOptions(request, runtime);
}

model DescribeCommandInvocationsRequest {
  commandId?: string(name='CommandId', description='The command ID. You can call the [DescribeCommands](https://help.aliyun.com/document_detail/64843.html) operation to query all available command IDs.', example='c-sh02yh0932w****'),
  commandName?: string(name='CommandName', description='The command name. If both CommandName and InstanceId are specified, CommandName does not take effect.', example='testName'),
  commandType?: string(name='CommandType', description='The command type. Valid values:

*   RunBatScript: batch command, applicable to Windows instances
*   RunPowerShellScript: PowerShell command, applicable to Windows instances
*   RunShellScript: shell command, applicable to Linux instances', example='RunPowerShellScript'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.', example='ace0706b2ac4454d984295a94213****'),
  invocationStatus?: string(name='InvocationStatus', description='The overall execution state of the command. The value of this parameter depends on the execution status of the command on all the involved instances. Valid values:

*   Pending: The command is being verified or sent. When the execution state on at least one instance is Pending, the overall execution state is Pending.

*   Running: The command is being run on the instances. When the execution state on at least one instance is Running, the overall execution state is Running.

*   Success: When the execution state on at least one instance is Success and the execution state on other instances is Stopped or Success, the overall execution state is Success.

    *   Command that is set to run immediately: The command execution is complete, and the exit code is 0.

*   Failed: When the execution state on all instances is Stopped or Failed, the overall execution state is Failed. When the execution state on an instance is one of the following values, Failed is returned as the overall execution state:

    *   Invalid: The command is invalid.
    *   Aborted: The command fails to be sent.
    *   Failed: The command execution is complete, and the exit code is not 0.
    *   Timeout: The command execution times out.
    *   Error: An error occurs when the command is being run.

*   Stopping: The command task is being stopped. When the execution state on at least one instance is Stopping, the overall execution state is Stopping.

*   Stopped: The command task is stopped. When the execution state on all instances is Stopped, the overall execution state is Stopped. When the execution state on an instance is one of the following values, Stopped is returned as the overall execution state:

    *   Cancelled: The command task is canceled.
    *   Terminated: The command task is terminated.

*   PartialFailed: The command execution succeeds on some instances and fails on other instances. When the execution state on some instances is Success and the execution state on other instances is Failed or Stopped, the overall execution state is PartialFailed.

>  The value of the `InvokeStatus` response parameter is similar to the value of InvocationStatus. We recommend that you ignore InvokeStatus and check the value of InvocationStatus.', example='Success'),
  invokeId?: string(name='InvokeId', description='The execution ID of the command.', example='t-hz02p9545t6****'),
  pageNumber?: string(name='PageNumber', description='The page number. Pages start from 1. Default value: 1.', example='1'),
  pageSize?: string(name='PageSize', description='The number of entries per page.

Maximum value: 50.

Default value: 10.', example='10'),
  regionId?: string(name='RegionId', description='The region ID. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeCommandInvocationsResponseBody = {
  commandInvocations?: [ 
    {
      commandContent?: string(name='CommandContent', description='The content of the command.', example='echo 123'),
      commandDescription?: string(name='CommandDescription', description='The description of the command.', example='testDescription'),
      commandId?: string(name='CommandId', description='The command ID.', example='c-hy0338xh28r****'),
      commandName?: string(name='CommandName', description='The command name.', example='testCommandName'),
      commandType?: string(name='CommandType', description='The command type.', example='RunShellScript'),
      creationTime?: string(name='CreationTime', description='The time when the command was created.', example='2023-04-27T10:11:58'),
      invocationStatus?: string(name='InvocationStatus', description='The overall execution state of the command. Valid values:

*   Pending: The command is being verified or sent.
*   Invalid: The specified command type or parameter is invalid.
*   Aborted: The command failed to be sent to the instances. To send a command to an instance, make sure that the instance is in the Running state and the command is sent to the instance within 1 minute.
*   Running: The command is being run on the instances.
*   Success: The command execution is complete, and the exit code is 0.
*   Failed: The command execution is complete, and the exit code is not 0.
*   Error: The command execution cannot proceed due to an exception.
*   Timeout: The command execution timed out.
*   Cancelled: The command execution is canceled, and the command is not started.
*   Stopping: The command in the Running state is being stopped.
*   Terminated: The command is terminated when it is being run.', example='Success'),
      invokeId?: string(name='InvokeId', description='The execution ID of the command.', example='t-hz0373jyzxt****'),
      invokeInstances?: [ 
        {
          errorCode?: string(name='ErrorCode', description='The error code returned if the command failed to be sent or run.

*   null: The command is run as expected.
*   InstanceNotExists: The specified instance does not exist or is released.
*   InstanceReleased: The instance is released when the command is being run.
*   InstanceNotRunning: The instance is not in the Running state when the command is being run.
*   CommandNotApplicable: The command is not applicable to the specified instance.
*   AccountNotExists: The specified account does not exist.
*   DirectoryNotExists: The specified directory does not exist.
*   BadCronExpression: The specified CRON expression for the execution schedule is invalid.
*   ClientNotRunning: Cloud Assistant Agent is not running.
*   ClientNotResponse: Cloud Assistant Agent does not respond to your request.
*   ClientIsUpgrading: Cloud Assistant Agent is being updated.
*   ClientNeedUpgrade: Cloud Assistant Agent needs to be updated.
*   DeliveryTimeout: The request to send the command timed out.
*   ExecutionTimeout: The command execution timed out.
*   ExecutionException: An exception occurred when the command was being run.
*   ExecutionInterrupted: The command execution is interrupted.
*   ExitCodeNonzero: The command execution is complete, and the exit code is not 0.', example='InstanceNotExists'),
          errorInfo?: string(name='ErrorInfo', description='The error message returned if the command failed to be sent or run. Valid values:

*   null: The command is run as expected.
*   the specified instance does not exists: The specified instance does not exist or is released.
*   the instance has released when create task: The instance is released when the command is being run.
*   the instance is not running when create task: The instance is not in the Running state when the command is being run.
*   the command is not applicable: The command is not applicable to the specified instance.
*   the specified account does not exists: The specified account does not exist.
*   the specified directory does not exists: The specified directory does not exist.
*   the cron job expression is invalid: The specified CRON expression for the execution schedule is invalid.
*   the aliyun service is not running on the instance: Cloud Assistant Agent is not running.
*   the aliyun service in the instance does not response: Cloud Assistant Agent does not respond to your request.
*   the aliyun service in the instance is upgrading now: Cloud Assistant Agent is being updated.
*   the aliyun service in the instance need upgrade: Cloud Assistant Agent needs to be updated.
*   the command delivery has been timeout: The request to send the command timed out.
*   the command execution has been timeout: The command execution timed out.
*   the command execution got an exception: An exception occurred when the command was being run.
*   the command execution has been interrupted: The command execution is interrupted.
*   the command execution exit code is not zero: The command execution is complete, and the exit code is not 0.', example='the specified instance does not exists'),
          exitCode?: long(name='ExitCode', description='The exit code of the command.

*   For Linux instances, the exit code is the exit code of the shell command.
*   For Windows instances, the exit code is the exit code of the batch or PowerShell command.', example='0'),
          finishTime?: string(name='FinishTime', description='The end of the time range during which the command is run on the instance.', example='2023-04-03T02:42:29Z'),
          instanceId?: string(name='InstanceId', description='The ID of the simple application server.', example='2445f4aecdac4b71ba2c7e3a7ccf****'),
          invocationStatus?: string(name='InvocationStatus', description='The execution state of the command on a single instance. Valid values:

*   Pending: The command is being verified or sent.

*   Invalid: The specified command type or parameter is invalid.

*   Aborted: The command failed to be sent to the instance. To send a command to an instance, make sure that the instance is in the Running state and the command is sent to the instance within 1 minute.

*   Running: The command is being run on the instance.

*   Success:

    *   Command that is set to run only once: The command execution is complete, and the exit code is 0.
    *   Command that is set to run on a schedule: The previous command execution is complete, the exit code is 0, and the specified cycle ends.

*   Failed:

    *   Command that is set to run only once: The command execution is complete, and the exit code is not 0.
    *   Command that is set to run on a schedule: The previous command execution is complete, the exit code is not 0, and the specified cycle is about to end.

*   Error: The command execution cannot proceed due to an exception.

*   Timeout: The command execution timed out.

*   Cancelled: The command execution is canceled, and the command is not started.

*   Stopping: The command task is being stopped.

*   Terminated: The command is terminated when it is being run.', example='Running'),
          output?: string(name='Output', description='The command output.', example='OutputMsg'),
          startTime?: string(name='StartTime', description='The beginning of the time range during which the command is run on the instance.', example='2023-05-09T03:32:24Z'),
        }
      ](name='InvokeInstances', description='The instances on which the command is run.'),
      parameters?: string(name='Parameters', description='The custom parameters in the command. If no custom parameter exists in the command, the default value is {}.', example='{}'),
      timeout?: long(name='Timeout', description='The timeout period. Unit: seconds.', example='60'),
      username?: string(name='Username', description='The username that is used to run the command.', example='root'),
      workingDir?: string(name='WorkingDir', description='The working directory of the command.', example='c:\\\\wwwroot'),
    }
  ](name='CommandInvocations', description='The command executions.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
  totalCount?: int32(name='TotalCount', description='The total number of entries.', example='10'),
}

model DescribeCommandInvocationsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCommandInvocationsResponseBody(name='body'),
}

/**
 * @summary Queries the executions and execution status of a Cloud Assistant command.
 *
 * @param request DescribeCommandInvocationsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCommandInvocationsResponse
 */
async function describeCommandInvocationsWithOptions(request: DescribeCommandInvocationsRequest, runtime: Util.RuntimeOptions): DescribeCommandInvocationsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.commandId)) {
    query['CommandId'] = request.commandId;
  }
  if (!Util.isUnset(request.commandName)) {
    query['CommandName'] = request.commandName;
  }
  if (!Util.isUnset(request.commandType)) {
    query['CommandType'] = request.commandType;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.invocationStatus)) {
    query['InvocationStatus'] = request.invocationStatus;
  }
  if (!Util.isUnset(request.invokeId)) {
    query['InvokeId'] = request.invokeId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeCommandInvocations',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the executions and execution status of a Cloud Assistant command.
 *
 * @param request DescribeCommandInvocationsRequest
 * @return DescribeCommandInvocationsResponse
 */
async function describeCommandInvocations(request: DescribeCommandInvocationsRequest): DescribeCommandInvocationsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeCommandInvocationsWithOptions(request, runtime);
}

model DescribeCommandsRequest {
  commandId?: string(name='CommandId', description='The command ID.', example='c-sh02yh0932w****'),
  name?: string(name='Name', description='The command name. Fuzzy match is not supported.', example='testName'),
  pageNumber?: string(name='PageNumber', description='The page number.

Pages start from 1.

Default value: 1.', example='1'),
  pageSize?: string(name='PageSize', description='The number of entries per page.

Maximum value: 50.

Default value: 10.', example='10'),
  provider?: string(name='Provider', description='The provider of the common command. Take note of the following items:

*   If you set this parameter to `AlibabaCloud`, all the common commands provided by Alibaba Cloud are queried.
*   If you set this parameter to `User`, all the custom commands created by you are queried.

This parameter is required.', example='AlibabaCloud'),
  regionId?: string(name='RegionId', description='The region ID.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The resource group ID.', example='rg-aek2bti7cf7****'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key of the command. A tag key can be 1 to 64 characters in length. Valid values of N: 1 to 20.', example='TestKey'),
      value?: string(name='Value', description='The tag value of the command. A tag value can be up to 64 characters in length. Valid values of N: 1 to 20.', example='TestValue'),
    }
  ](name='Tag', description='The tags that are bound to the command.'),
  type?: string(name='Type', description='The language type of the command. Valid values:

*   RunBatScript: batch command, applicable to Windows instances
*   RunPowerShellScript: PowerShell command, applicable to Windows instances
*   RunShellScript: shell command, applicable to Linux instances', example='RunShellScript'),
}

model DescribeCommandsResponseBody = {
  commands?: [ 
    {
      commandContent?: string(name='CommandContent', description='The content of the command.', example='cat /etc/ssh/sshd_config'),
      commandId?: string(name='CommandId', description='The command ID.', example='c-gov1k1tqwi9****'),
      creationTime?: string(name='CreationTime', description='The time when the command was created.', example='2023-01-05T06:38:53Z'),
      description?: string(name='Description', description='The description of the command.', example='testDescription'),
      enableParameter?: boolean(name='EnableParameter', description='Indicates whether the custom parameter feature is enabled for the command.', example='false'),
      name?: string(name='Name', description='The name of the command.', example='testName'),
      parameterDefinitions?: [ 
        {
          defaultValue?: string(name='DefaultValue', description='The default value of the custom parameter.', example='https://aliyun-client-assist.oss-accelerate.aliyuncs.com/linux/aliyun_assist_latest.rpm'),
          description?: string(name='Description', description='The description of the custom parameter.', example='Command Assistant Agent Installation Package Path'),
          parameterName?: string(name='ParameterName', description='The name of the custom parameter.', example='DownloadUrl'),
          possibleValues?: [ string ](name='PossibleValues', description='The valid values of the custom parameter.'),
          required?: boolean(name='Required', description='Indicates whether the custom parameter is required. Valid values:

*   true
*   false

Default value: false.', example='false'),
        }
      ](name='ParameterDefinitions', description='Details of the custom parameter.'),
      parameterNames?: [ string ](name='ParameterNames', description='The custom parameter names that are parsed from the command content specified when the command was created. The custom parameter names are returned in the list format. If the custom parameter feature is disabled, an empty list is returned.'),
      provider?: string(name='Provider', description='The provider of the command.', example='User'),
      resourceGroupId?: string(name='ResourceGroupId', description='The resource group ID.', example='rg-aek2bti7cf7****'),
      tags?: [ 
        {
          key?: string(name='Key', description='The tag key of the command.', example='TestKey'),
          value?: string(name='Value', description='The tag value of the command.', example='TestValue'),
        }
      ](name='Tags', description='The tags that are bound to the command.'),
      timeout?: long(name='Timeout', description='The timeout period of the command.', example='60'),
      type?: string(name='Type', description='The type of the command.', example='RunShellScript'),
      workingDir?: string(name='WorkingDir', description='The execution path of the command.', example='/home'),
    }
  ](name='Commands', description='The queried commands.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
  totalCount?: int32(name='TotalCount', description='The total number of commands.', example='10'),
}

model DescribeCommandsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCommandsResponseBody(name='body'),
}

/**
 * @summary Queries the commands that you created or the common commands that Alibaba Cloud provides.
 *
 * @param request DescribeCommandsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCommandsResponse
 */
async function describeCommandsWithOptions(request: DescribeCommandsRequest, runtime: Util.RuntimeOptions): DescribeCommandsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.commandId)) {
    query['CommandId'] = request.commandId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.provider)) {
    query['Provider'] = request.provider;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeCommands',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the commands that you created or the common commands that Alibaba Cloud provides.
 *
 * @param request DescribeCommandsRequest
 * @return DescribeCommandsResponse
 */
async function describeCommands(request: DescribeCommandsRequest): DescribeCommandsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeCommandsWithOptions(request, runtime);
}

model DescribeDatabaseErrorLogsRequest {
  databaseInstanceId?: string(name='DatabaseInstanceId', description='The ID of the Simple Database Service instance.

This parameter is required.', example='db-38263fa955774501a2ae1bdaed6f****'),
  endTime?: string(name='EndTime', description='The end of the time range to query. Specify the time in the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC. The end time must be later than the start time.

> The time displayed in the Simple Application Server console is in the format of UTC+8.

This parameter is required.', example='2022-09-08T04:04Z'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='30'),
  regionId?: string(name='RegionId', description='The region ID of the Simple Database Service instance.

You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify the time in the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

> The time displayed in the Simple Application Server console is in the format of UTC+8.

This parameter is required.', example='2022-09-07T04:04Z'),
}

model DescribeDatabaseErrorLogsResponseBody = {
  errorLogs?: [ 
    {
      createTime?: string(name='CreateTime', description='The time when the resource was created. The time follows the ISO 8601 standard in the `yyyy-MM-ddTHH:mm:ssZ` format. The time is displayed in UTC.', example='2022-09-08T12:11:04Z'),
      errorInfo?: string(name='ErrorInfo', description='The error message returned.', example='spid52 DBCC TRACEON 3499, server process ID (SPID) 52. This is an informational message only; no user action is required'),
    }
  ](name='ErrorLogs', description='The time when the error log entry was generated. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

> The time displayed in the Simple Application Server console is in the format of UTC+8.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='30'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='20'),
}

model DescribeDatabaseErrorLogsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDatabaseErrorLogsResponseBody(name='body'),
}

/**
 * @summary Queries error logs of databases in a Simple Database Service instance.
 *
 * @description You can call this operation to query the error logs of databases in a Simple Database Service instance and locate faults based on the error logs.
 *
 * @param request DescribeDatabaseErrorLogsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDatabaseErrorLogsResponse
 */
async function describeDatabaseErrorLogsWithOptions(request: DescribeDatabaseErrorLogsRequest, runtime: Util.RuntimeOptions): DescribeDatabaseErrorLogsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.databaseInstanceId)) {
    query['DatabaseInstanceId'] = request.databaseInstanceId;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDatabaseErrorLogs',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries error logs of databases in a Simple Database Service instance.
 *
 * @description You can call this operation to query the error logs of databases in a Simple Database Service instance and locate faults based on the error logs.
 *
 * @param request DescribeDatabaseErrorLogsRequest
 * @return DescribeDatabaseErrorLogsResponse
 */
async function describeDatabaseErrorLogs(request: DescribeDatabaseErrorLogsRequest): DescribeDatabaseErrorLogsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDatabaseErrorLogsWithOptions(request, runtime);
}

model DescribeDatabaseInstanceMetricDataRequest {
  databaseInstanceId?: string(name='DatabaseInstanceId', description='The ID of the Simple Database Service instance.

This parameter is required.', example='db-38263fa955774501a2ae1bdaed6f****'),
  endTime?: string(name='EndTime', description='The end of the time range to query. Specify the time in the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

> The time displayed in the Simple Application Server console is in the format of UTC+8.

This parameter is required.', example='2022-09-07T04:04Z'),
  metricName?: string(name='MetricName', description='The name of the metric. Valid values:

*   MySQL_MemCpuUsage: The CPU utilization and memory usage of the instance within the entire operating system.
*   MySQL_DetailedSpaceUsage: The total space usage, data space, log space, temporary space, and system space of the instance.
*   MySQL_Sessions : The total number of active connections.
*   MySQL_IOPS: The IOPS of the instance.

This parameter is required.', example='MySQL_MemCpuUsage'),
  regionId?: string(name='RegionId', description='The region ID of the Simple Database Service instance. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify the time in the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

> The time displayed in the Simple Application Server console is in the format of UTC+8.

This parameter is required.', example='2022-09-06T04:04Z'),
}

model DescribeDatabaseInstanceMetricDataResponseBody = {
  dataFormat?: string(name='DataFormat', description='The data format. Valid values:

*   cpuusage\\\\&memusage
*   active_session\\\\&total_session
*   ins_size\\\\&data_size\\\\&log_size\\\\&tmp_size\\\\&other_size
*   io', example='cpuusage&memusage'),
  metricData?: string(name='MetricData', description='The monitoring data.', example='[  {     \\\\"date"\\\\: " 2022-09-06T04:04:00Z",\\\\"value\\\\":\\\\"0.77&3.69\\\\"  } ]'),
  metricName?: string(name='MetricName', description='The name of the metric. Valid values:

*   MySQL_MemCpuUsage: The CPU utilization and memory usage of the instance within the entire operating system.
*   MySQL_DetailedSpaceUsage: The total space usage, data space, log space, temporary space, and system space of the instance.
*   MySQL_Sessions : The total number of active connections.
*   MySQL_IOPS: The IOPS of the instance.', example='MySQL_MemCpuUsage'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
  unit?: string(name='Unit', description='The unit of the monitoring metric.

*   %
*   int
*   MB', example='%'),
}

model DescribeDatabaseInstanceMetricDataResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDatabaseInstanceMetricDataResponseBody(name='body'),
}

/**
 * @summary Queries the monitoring information about a Simple Database Service instance.
 *
 * @description After you create a Simple Database Service instance, you can query the details about the instance, including CPU, memory, and disk usage, storage IOPS, and total number of connections.
 *
 * @param request DescribeDatabaseInstanceMetricDataRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDatabaseInstanceMetricDataResponse
 */
async function describeDatabaseInstanceMetricDataWithOptions(request: DescribeDatabaseInstanceMetricDataRequest, runtime: Util.RuntimeOptions): DescribeDatabaseInstanceMetricDataResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.databaseInstanceId)) {
    query['DatabaseInstanceId'] = request.databaseInstanceId;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.metricName)) {
    query['MetricName'] = request.metricName;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDatabaseInstanceMetricData',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the monitoring information about a Simple Database Service instance.
 *
 * @description After you create a Simple Database Service instance, you can query the details about the instance, including CPU, memory, and disk usage, storage IOPS, and total number of connections.
 *
 * @param request DescribeDatabaseInstanceMetricDataRequest
 * @return DescribeDatabaseInstanceMetricDataResponse
 */
async function describeDatabaseInstanceMetricData(request: DescribeDatabaseInstanceMetricDataRequest): DescribeDatabaseInstanceMetricDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDatabaseInstanceMetricDataWithOptions(request, runtime);
}

model DescribeDatabaseInstanceParametersRequest {
  databaseInstanceId?: string(name='DatabaseInstanceId', description='The ID of the Simple Database Service instance.

This parameter is required.', example='db-38263fa955774501a2ae1bdaed6f****'),
  regionId?: string(name='RegionId', description='The region ID of the Simple Database Service instance. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeDatabaseInstanceParametersResponseBody = {
  configParameters?: [ 
    {
      checkingCode?: string(name='CheckingCode', description='The check code that indicates the valid values of the parameter.', example='[1-65535]'),
      forceModify?: string(name='ForceModify', description='Does it support modifying parameter values. Possible values:

- true:Support modifying parameter values.

- false:Modifying parameter values is not supported.', example='true'),
      forceRestart?: string(name='ForceRestart', description='Specifies whether to forcibly restart the instance after parameters are modified. Valid values:

*   true: forcibly restarts the instance. If a new parameter value takes effect only after the instance restarts, you must set this parameter to true. Otherwise, the new parameter value cannot take effect.
*   false: does not forcibly restart the instance.

Default value: false.', example='false'),
      parameterDescription?: string(name='ParameterDescription', description='The description of the parameter.', example='Auto-increment columns are incremented by this'),
      parameterName?: string(name='ParameterName', description='The name of the parameter.', example='auto_increment_increment'),
      parameterValue?: string(name='ParameterValue', description='The value of the parameter.', example='1'),
    }
  ](name='ConfigParameters', description='The range of ParameterValue.

> The value of CheckingCode varies based on the value of ParameterName.'),
  engine?: string(name='Engine', description='The database engine that the instance runs. The value must be MySQL.', example='MySQL'),
  engineVersion?: string(name='EngineVersion', description='The version of the database engine. Valid values:

*   5.7: MySQL 5.7.
*   8.0: MySQL 8.0.', example='5.5'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
  runningParameters?: [ 
    {
      checkingCode?: string(name='CheckingCode', description='The check code that indicates the valid values of the parameter.', example='[ON|OFF]'),
      forceModify?: string(name='ForceModify', description='Does it support modifying parameter values. Possible values:

- true:Support modifying parameter values.

- false:Modifying parameter values is not supported.', example='true'),
      forceRestart?: string(name='ForceRestart', description='Specifies whether to forcibly restart the instance after parameters are modified. Valid values:

*   true: forcibly restarts the instance. If a new parameter value takes effect only after the instance restarts, you must set this parameter to true. Otherwise, the new parameter value cannot take effect.
*   false: does not forcibly restart the instance.

Default value: false.', example='false'),
      parameterDescription?: string(name='ParameterDescription', description='The description of the parameter.', example='When this variable has a value of 1 (the default), the server automatically grants the EXECUTE and ALTER ROUTINE privileges to the creator of a stored routine, if the user cannot already execute and alter or drop the routine. (The ALTER ROUTINE privilege is required to drop the routine.) The server also automatically drops those privileges from the creator when the routine is dropped. If automatic_sp_privileges is 0, the server does not automatically add or drop these privileges.'),
      parameterName?: string(name='ParameterName', description='The name of the parameter.', example='autocommit'),
      parameterValue?: string(name='ParameterValue', description='The value of the parameter.', example='ON'),
    }
  ](name='RunningParameters', description='The range of ParameterValue.

> The value of CheckingCode varies based on the value of ParameterName.'),
}

model DescribeDatabaseInstanceParametersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDatabaseInstanceParametersResponseBody(name='body'),
}

/**
 * @summary Queries the parameters of a Simple Database Service instance.
 *
 * @description You can call this operation to query the information about parameters of a Simple Database Service instance.
 *
 * @param request DescribeDatabaseInstanceParametersRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDatabaseInstanceParametersResponse
 */
async function describeDatabaseInstanceParametersWithOptions(request: DescribeDatabaseInstanceParametersRequest, runtime: Util.RuntimeOptions): DescribeDatabaseInstanceParametersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.databaseInstanceId)) {
    query['DatabaseInstanceId'] = request.databaseInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDatabaseInstanceParameters',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the parameters of a Simple Database Service instance.
 *
 * @description You can call this operation to query the information about parameters of a Simple Database Service instance.
 *
 * @param request DescribeDatabaseInstanceParametersRequest
 * @return DescribeDatabaseInstanceParametersResponse
 */
async function describeDatabaseInstanceParameters(request: DescribeDatabaseInstanceParametersRequest): DescribeDatabaseInstanceParametersResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDatabaseInstanceParametersWithOptions(request, runtime);
}

model DescribeDatabaseInstancesRequest {
  databaseInstanceIds?: string(name='DatabaseInstanceIds', description='The IDs of the Simple Database Service instances. The value can be a JSON array that consists of up to 100 Simple Database Service instance IDs. Separate multiple instance IDs with commas (,).', example='["swasdb-xxx******","swasdb-yyy******"]'),
  pageNumber?: int32(name='PageNumber', description='The page number.

Pages start from page 1.

Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.

Maximum value: 100.

Default value: 10.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the Simple Database Service instances.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeDatabaseInstancesResponseBody = {
  databaseInstances?: [ 
    {
      businessStatus?: string(name='BusinessStatus', description='The business status of the instance. Valid values:

*   normal
*   expired
*   overdue', example='normal'),
      chargeType?: string(name='ChargeType', description='The billing method of the Simple Database Service instance. Set the value to PrePaid. This value indicates the subscription billing method.

Default value: PrePaid.', example='PrePaid'),
      cpu?: string(name='Cpu', description='The number of vCPUs.', example='1'),
      creationTime?: string(name='CreationTime', description='The time when the instance was created. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2022-09-01T02:39:46Z'),
      databaseInstanceEdition?: string(name='DatabaseInstanceEdition', description='The plan edition ID of the Simple Database Service instance. Valid values:

*   swas.db.c1m1s25: CNY 35/month.
*   swas.db.c1m2s80: CNY 100/month.
*   swas.db.c2m4s120: CNY 200/month.
*   swas.db.c2m8s240: CNY 300/month.', example='swas.db.c1m1s25'),
      databaseInstanceId?: string(name='DatabaseInstanceId', description='The ID of the Simple Database Service instance.', example='db-38263fa955774501a2ae1bdaed6f****'),
      databaseInstanceName?: string(name='DatabaseInstanceName', description='The name of the Simple Database Service instance.'),
      databaseInstanceStatus?: string(name='DatabaseInstanceStatus', description='The status of the Simple Database Service instance. Valid values:

*   Pending: The instance is being created.
*   Restarting: The instance is being restarted.
*   Running: The instance is running.
*   Stopping: The instance is being stopped.
*   Stopped: The instance is stopped.
*   UPGRADING: The instance is being upgraded.
*   DISABLED: The instance is disabled.', example='Running'),
      databaseVersion?: string(name='DatabaseVersion', description='The database engine version of the instance. Valid values:

*   5.7: MySQL 5.7.
*   8.0: MySQL 8.0.', example='5.7'),
      expiredTime?: string(name='ExpiredTime', description='The time when the instance expires. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

>  The time displayed in the Simple Application Server console is in the format of UTC+8.', example='2022-10-01T16:00:00Z'),
      memory?: string(name='Memory', description='The memory size of the instance. Unit: GB.', example='1'),
      privateConnection?: string(name='PrivateConnection', description='The private endpoint.', example='rm-bp1d39opj7906****.mysql.rds.aliyuncs.com'),
      publicConnection?: string(name='PublicConnection', description='The public endpoint.

>  This parameter is displayed only after you apply for a public endpoint for the instance and a public endpoint is assigned to the instance. You can call [AllocatePublicConnection](https://help.aliyun.com/document_detail/451413.html) to apply for a public endpoint for the instance.', example='db-38263fa955774501a2ae1bdaed6f****.mysql.rds.aliyuncs.com'),
      regionId?: string(name='RegionId', description='The region ID of the Simple Database Service instances.', example='cn-hangzhou'),
      storage?: int32(name='Storage', description='The size of the enhanced SSD (ESSD). Unit: GB.', example='25'),
      superAccountName?: string(name='SuperAccountName', description='The name of the super administrator account of the Simple Database Service instance.', example='administrator'),
    }
  ](name='DatabaseInstances', description='The information about the Simple Database Service instances.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='10'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='1'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4****'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='5'),
}

model DescribeDatabaseInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDatabaseInstancesResponseBody(name='body'),
}

/**
 * @summary Queries the information about Simple Database Service instances.
 *
 * @description You can call this operation to query the details of Simple Database Service instances in a region, including the IDs, names, plans, database versions, public endpoints, internal endpoints, creation time, and expiration time of the instances.
 *
 * @param request DescribeDatabaseInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDatabaseInstancesResponse
 */
async function describeDatabaseInstancesWithOptions(request: DescribeDatabaseInstancesRequest, runtime: Util.RuntimeOptions): DescribeDatabaseInstancesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.databaseInstanceIds)) {
    query['DatabaseInstanceIds'] = request.databaseInstanceIds;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDatabaseInstances',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information about Simple Database Service instances.
 *
 * @description You can call this operation to query the details of Simple Database Service instances in a region, including the IDs, names, plans, database versions, public endpoints, internal endpoints, creation time, and expiration time of the instances.
 *
 * @param request DescribeDatabaseInstancesRequest
 * @return DescribeDatabaseInstancesResponse
 */
async function describeDatabaseInstances(request: DescribeDatabaseInstancesRequest): DescribeDatabaseInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDatabaseInstancesWithOptions(request, runtime);
}

model DescribeDatabaseSlowLogRecordsRequest {
  databaseInstanceId?: string(name='DatabaseInstanceId', description='The ID of the Simple Database Service instance.

This parameter is required.', example='db-38263fa955774501a2ae1bdaed6f****'),
  endTime?: string(name='EndTime', description='The end of the time range to query. The end time must be later than the start time. The interval between the start time and the end time must be less than 7 days.

Specify the time in the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

> The time displayed in the Simple Application Server console is in the format of UTC+8.

This parameter is required.', example='2022-09-08T04:04:44Z'),
  pageNumber?: int32(name='PageNumber', description='The page number.

Pages start from page 1.

Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values: 30 to 100.

Maximum value: 100.

Default value: 30.', example='30'),
  regionId?: string(name='RegionId', description='The region ID of the Simple Database Service instance. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query.

Specify the time in the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

> The time displayed in the Simple Application Server console is in the format of UTC+8.

This parameter is required.', example='2022-09-07T04:04:44Z'),
}

model DescribeDatabaseSlowLogRecordsResponseBody = {
  engine?: string(name='Engine', description='The database engine that the instance runs.', example='MySQL'),
  pageNumber?: int32(name='PageNumber', description='The page number.

Pages start from page 1.

Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Valid values: 30 to 100.

Default value: 30.', example='30'),
  physicalIORead?: long(name='PhysicalIORead', description='The number of logical reads.', example='200'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
  slowLogs?: [ 
    {
      DBName?: string(name='DBName', description='The name of the database.', example='testDB'),
      executionStartTime?: string(name='ExecutionStartTime', description='The time when the execution of the SQL statement started. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

>  The time displayed in the Simple Application Server console is in the format of UTC+8.', example='2022-09-08T01:40:44Z'),
      hostAddress?: string(name='HostAddress', description='The name and IP address of the client that is connected to the database.', example='xxx[xxx] @ [1xx.xxx.xxx.xx]'),
      lockTimes?: long(name='LockTimes', description='The lock duration of the SQL statement. Unit: seconds.', example='0'),
      parseRowCounts?: long(name='ParseRowCounts', description='The number of rows parsed by the SQL statement.', example='1'),
      queryTimeMS?: long(name='QueryTimeMS', description='The execution duration of the slow query. Unit: millisecond.', example='2001'),
      queryTimes?: long(name='QueryTimes', description='The execution duration of the slow query. Unit: seconds.', example='2'),
      returnRowCounts?: long(name='ReturnRowCounts', description='The number of rows returned by the SQL statement.', example='1'),
      SQLText?: string(name='SQLText', description='The details of the SQL statement.', example='select sleep(2)'),
    }
  ](name='SlowLogs', description='The slow query logs returned.'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='20'),
}

model DescribeDatabaseSlowLogRecordsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDatabaseSlowLogRecordsResponseBody(name='body'),
}

/**
 * @summary Queries the slow query log details of a Simple Database Service instance.
 *
 * @description You can query the slow query log details of a Simple Database Service instance and locate faults based on the log details.
 * >  Slow query log details are retained for 7 days.
 *
 * @param request DescribeDatabaseSlowLogRecordsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDatabaseSlowLogRecordsResponse
 */
async function describeDatabaseSlowLogRecordsWithOptions(request: DescribeDatabaseSlowLogRecordsRequest, runtime: Util.RuntimeOptions): DescribeDatabaseSlowLogRecordsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.databaseInstanceId)) {
    query['DatabaseInstanceId'] = request.databaseInstanceId;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDatabaseSlowLogRecords',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the slow query log details of a Simple Database Service instance.
 *
 * @description You can query the slow query log details of a Simple Database Service instance and locate faults based on the log details.
 * >  Slow query log details are retained for 7 days.
 *
 * @param request DescribeDatabaseSlowLogRecordsRequest
 * @return DescribeDatabaseSlowLogRecordsResponse
 */
async function describeDatabaseSlowLogRecords(request: DescribeDatabaseSlowLogRecordsRequest): DescribeDatabaseSlowLogRecordsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDatabaseSlowLogRecordsWithOptions(request, runtime);
}

model DescribeFirewallTemplateApplyResultsRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  firewallTemplateId?: string(name='FirewallTemplateId', description='The ID of the firewall template.', example='ft-bcf1a7hrdq717****'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Default value: 20.', example='20'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  taskId?: [ string ](name='TaskId', description='The ID of the execution to apply the template.'),
}

model DescribeFirewallTemplateApplyResultsResponseBody = {
  pageNumber?: string(name='PageNumber', description='The page number.', example='1'),
  pageSize?: string(name='PageSize', description='The number of entries per page. Default value: 20.', example='20'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
  totalCount?: string(name='TotalCount', description='The total number of entries returned.', example='1'),
  data?: [ 
    {
      createTime?: string(name='CreateTime', description='The time when the firewall template was applied to the simple application servers.', example='Tue May 14 11:53:07 CST 2024'),
      failedCount?: string(name='FailedCount', description='The total number of simple application servers to which the firewall template fails to apply.', example='0'),
      firewallTemplateId?: string(name='FirewallTemplateId', description='The ID of the firewall template.', example='ft-bcf1a7hrdq717****'),
      instanceApplyResults?: [ 
        {
          instanceId?: string(name='InstanceId', description='The ID of the simple application server.', example='33774babccc84003a2b1ad47e8001233'),
          status?: string(name='Status', description='The status of applying the firewall template to the simple application servers. Valid values:

*   Running: The firewall template is being applied to the simple application servers.
*   Failed: The firewall template is applied to none of the simple application servers.
*   Success: The firewall template is applied to all the simple application servers.
*   PartFailed: The firewall template fails to be applied to some simple application servers.', example='Success'),
        }
      ](name='InstanceApplyResults', description='The result of applying the firewall template to the simple application servers.'),
      status?: string(name='Status', description='The status of applying the template to all simple application servers. Valid values:

*   Running: The firewall template is being applied to simple application servers.
*   Failed: The firewall template is applied to none of simple application servers.
*   Success: The firewall template is applied to all simple application servers.
*   PartFailed: The firewall template fails to be applied to some simple application servers.', example='Success'),
      taskId?: string(name='TaskId', description='The ID of the execution to apply the template.', example='aft-ikgt0bynitvs3****'),
      totalCount?: string(name='TotalCount', description='The total number of entries returned.', example='1'),
    }
  ](name='data', description='The returned results.'),
}

model DescribeFirewallTemplateApplyResultsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeFirewallTemplateApplyResultsResponseBody(name='body'),
}

/**
 * @summary Queries the result of applying a firewall template to simple application servers.
 *
 * @param request DescribeFirewallTemplateApplyResultsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeFirewallTemplateApplyResultsResponse
 */
async function describeFirewallTemplateApplyResultsWithOptions(request: DescribeFirewallTemplateApplyResultsRequest, runtime: Util.RuntimeOptions): DescribeFirewallTemplateApplyResultsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.firewallTemplateId)) {
    query['FirewallTemplateId'] = request.firewallTemplateId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeFirewallTemplateApplyResults',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the result of applying a firewall template to simple application servers.
 *
 * @param request DescribeFirewallTemplateApplyResultsRequest
 * @return DescribeFirewallTemplateApplyResultsResponse
 */
async function describeFirewallTemplateApplyResults(request: DescribeFirewallTemplateApplyResultsRequest): DescribeFirewallTemplateApplyResultsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeFirewallTemplateApplyResultsWithOptions(request, runtime);
}

model DescribeFirewallTemplateRulesApplyResultRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  firewallTemplateId?: string(name='FirewallTemplateId', description='The ID of the firewall template.

This parameter is required.', example='ft-bcf1a7hrdq717****'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  taskId?: string(name='TaskId', description='The ID of the execution to apply the template rule.

This parameter is required.', example='aft-ikgt0bynitvs3****'),
}

model DescribeFirewallTemplateRulesApplyResultResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
  data?: [ 
    {
      errorCode?: string(name='ErrorCode', description='The error codes when the firewall template rule fails to be applied.', example='500'),
      errorInfo?: string(name='ErrorInfo', description='The error message that is displayed when the firewall template rule fails to be applied.', example='An error occurred while processing your request.'),
      port?: string(name='Port', description='The port range. Valid values: 1 to 65535. Specify a port range in the format of \\\\<start port number>/\\\\<end port number>. Example: `1024/1055`, which indicates that the port range of 1024 to 1055.

>  If you set RuleProtocol to ICMP, you must set Port to -1/-1.', example='8080'),
      remark?: string(name='Remark', description='The remarks of the firewall rule.', example='test'),
      ruleProtocol?: string(name='RuleProtocol', description='The transport layer protocol that the rule supports. Valid values:

*   TCP
*   UDP
*   TCP+UDP
*   ICMP', example='TCP'),
      sourceCidrIp?: string(name='SourceCidrIp', description='The source address to which you want to grant access permissions. CIDR blocks and IPv4 addresses are supported.', example='119.145.XX.XX'),
      success?: boolean(name='Success', description='The status of applying the firewall template rule to the simple application servers.

*   Pending: The template rule does not start to be applied to the simple application servers.
*   Applying: The template rule is being applied to the simple application servers.
*   Success: The template rule is successfully applied to the simple application servers.
*   PartFailed: The template rule fails to be applied to some simple application servers.', example='true'),
    }
  ](name='data', description='The returned results.'),
}

model DescribeFirewallTemplateRulesApplyResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeFirewallTemplateRulesApplyResultResponseBody(name='body'),
}

/**
 * @summary Queries the result of applying a firewall template rule to simple application servers.
 *
 * @param request DescribeFirewallTemplateRulesApplyResultRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeFirewallTemplateRulesApplyResultResponse
 */
async function describeFirewallTemplateRulesApplyResultWithOptions(request: DescribeFirewallTemplateRulesApplyResultRequest, runtime: Util.RuntimeOptions): DescribeFirewallTemplateRulesApplyResultResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.firewallTemplateId)) {
    query['FirewallTemplateId'] = request.firewallTemplateId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeFirewallTemplateRulesApplyResult',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the result of applying a firewall template rule to simple application servers.
 *
 * @param request DescribeFirewallTemplateRulesApplyResultRequest
 * @return DescribeFirewallTemplateRulesApplyResultResponse
 */
async function describeFirewallTemplateRulesApplyResult(request: DescribeFirewallTemplateRulesApplyResultRequest): DescribeFirewallTemplateRulesApplyResultResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeFirewallTemplateRulesApplyResultWithOptions(request, runtime);
}

model DescribeFirewallTemplatesRequest {
  firewallTemplateId?: [ string ](name='FirewallTemplateId', description='The IDs of the firewall templates.'),
  name?: string(name='Name', description='The name of the firewall template.', example='testName'),
  pageNumber?: int32(name='PageNumber', description='The page number.

Pages start from page 1.

Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Default value: 20.', example='20'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeFirewallTemplatesResponseBody = {
  firewallTemplates?: [ 
    {
      createTime?: string(name='CreateTime', description='The time when the firewall template was created. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

>  The time displayed in the Simple Application Server console is in the format of UTC+8.', example='2024-04-29T02:01:38Z'),
      creationTime?: string(name='CreationTime', description='The time when the firewall template was created. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2024-04-10T02:10:14Z'),
      description?: string(name='Description', description='The description of the firewall template.', example='test'),
      firewallTemplateId?: string(name='FirewallTemplateId', description='The ID of the firewall template.', example='ft-bcf1a7hrdq717****'),
      firewallTemplateRules?: [ 
        {
          firewallTemplateRuleId?: string(name='FirewallTemplateRuleId', description='The ID of the firewall template rule.', example='eeea34d9867b4d55a4ff8d5fcfbd****'),
          port?: string(name='Port', description='The port range. Valid values: 1 to 65535. Specify a port range in the format of \\\\<start port number>/\\\\<end port number>. Example: `1024/1055`, which indicates that the port range of 1024 to 1055.

>  If you set RuleProtocol to ICMP, you must set Port to -1/-1.', example='8080'),
          remark?: string(name='Remark', description='The remarks of the firewall template rule.', example='test'),
          ruleProtocol?: string(name='RuleProtocol', description='The transport layer protocol that the rule supports. Valid values:

*   TCP
*   UDP
*   TCP+UDP
*   ICMP', example='TCP'),
          sourceCidrIp?: string(name='SourceCidrIp', description='The source address to which you want to grant access permissions. CIDR blocks and IPv4 addresses are supported.', example='119.145.XX.XX'),
        }
      ](name='FirewallTemplateRules', description='The details of the firewall template rules.'),
      name?: string(name='Name', description='The name of the firewall template.', example='test'),
    }
  ](name='FirewallTemplates', description='The information about the queried firewall templates.'),
  pageNumber?: int32(name='PageNumber', description='The page number.

Pages start from page 1.

Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Default value: 20.', example='20'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='10'),
}

model DescribeFirewallTemplatesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeFirewallTemplatesResponseBody(name='body'),
}

/**
 * @summary Queries details about firewall templates.
 *
 * @param request DescribeFirewallTemplatesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeFirewallTemplatesResponse
 */
async function describeFirewallTemplatesWithOptions(request: DescribeFirewallTemplatesRequest, runtime: Util.RuntimeOptions): DescribeFirewallTemplatesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.firewallTemplateId)) {
    query['FirewallTemplateId'] = request.firewallTemplateId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeFirewallTemplates',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries details about firewall templates.
 *
 * @param request DescribeFirewallTemplatesRequest
 * @return DescribeFirewallTemplatesResponse
 */
async function describeFirewallTemplates(request: DescribeFirewallTemplatesRequest): DescribeFirewallTemplatesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeFirewallTemplatesWithOptions(request, runtime);
}

model DescribeInstanceKeyPairRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeInstanceKeyPairResponseBody = {
  fingerprint?: string(name='Fingerprint', description='The fingerprint of the key pair.', example='4f:70:62:e9:0c:72:f7:ee:74:ce:e3:bf:e0:82:**:**'),
  keyPairName?: string(name='KeyPairName', description='The name of the key pair.', example='KeyPairName'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
}

model DescribeInstanceKeyPairResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeInstanceKeyPairResponseBody(name='body'),
}

/**
 * @summary Queries information about the key pair of a simple application server.
 *
 * @param request DescribeInstanceKeyPairRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeInstanceKeyPairResponse
 */
async function describeInstanceKeyPairWithOptions(request: DescribeInstanceKeyPairRequest, runtime: Util.RuntimeOptions): DescribeInstanceKeyPairResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeInstanceKeyPair',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries information about the key pair of a simple application server.
 *
 * @param request DescribeInstanceKeyPairRequest
 * @return DescribeInstanceKeyPairResponse
 */
async function describeInstanceKeyPair(request: DescribeInstanceKeyPairRequest): DescribeInstanceKeyPairResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInstanceKeyPairWithOptions(request, runtime);
}

model DescribeInstancePasswordsSettingRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/2361076.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeInstancePasswordsSettingResponseBody = {
  instancePasswordSetting?: boolean(name='InstancePasswordSetting', description='Indicates whether a logon password is set for the simple application server.', example='true'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4****'),
  vncPasswordSetting?: boolean(name='VncPasswordSetting', description='Indicates whether a VNC connection password is set for the simple application server.', example='true'),
}

model DescribeInstancePasswordsSettingResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeInstancePasswordsSettingResponseBody(name='body'),
}

/**
 * @summary Checks whether a password is set for a simple application server.
 *
 * @param request DescribeInstancePasswordsSettingRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeInstancePasswordsSettingResponse
 */
async function describeInstancePasswordsSettingWithOptions(request: DescribeInstancePasswordsSettingRequest, runtime: Util.RuntimeOptions): DescribeInstancePasswordsSettingResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeInstancePasswordsSetting',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Checks whether a password is set for a simple application server.
 *
 * @param request DescribeInstancePasswordsSettingRequest
 * @return DescribeInstancePasswordsSettingResponse
 */
async function describeInstancePasswordsSetting(request: DescribeInstancePasswordsSettingRequest): DescribeInstancePasswordsSettingResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInstancePasswordsSettingWithOptions(request, runtime);
}

model DescribeInstanceVncUrlRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='2ad1ae67295445f598017499dc****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeInstanceVncUrlResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
  vncUrl?: string(name='VncUrl', description='The VNC connection address of the server.', example='wss%3A%2F%2Fhz01-vncproxy.aliyun.com%2Fwebsockify%2F%3Fs%3Dwz3L8wEMO6KMt7%252FXInEMtKVubBB%252F7rv055kOm8eUOD%252*****YlmsKjOfz6'),
}

model DescribeInstanceVncUrlResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeInstanceVncUrlResponseBody(name='body'),
}

/**
 * @summary Queries the VNC connection address of a simple application server.
 *
 * @param request DescribeInstanceVncUrlRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeInstanceVncUrlResponse
 */
async function describeInstanceVncUrlWithOptions(request: DescribeInstanceVncUrlRequest, runtime: Util.RuntimeOptions): DescribeInstanceVncUrlResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeInstanceVncUrl',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the VNC connection address of a simple application server.
 *
 * @param request DescribeInstanceVncUrlRequest
 * @return DescribeInstanceVncUrlResponse
 */
async function describeInstanceVncUrl(request: DescribeInstanceVncUrlRequest): DescribeInstanceVncUrlResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInstanceVncUrlWithOptions(request, runtime);
}

model DescribeInvocationResultRequest {
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  invokeId?: string(name='InvokeId', description='The execution ID. You can call the [DescribeInvocations](https://help.aliyun.com/document_detail/439368.html) operation to query execution IDs.

This parameter is required.', example='t-bj02prjhw1n****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [DescribeRegions](https://help.aliyun.com/document_detail/25609.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeInvocationResultResponseBody = {
  invocationResult?: {
    errorCode?: string(name='ErrorCode', description='The error code that is returned if the command failed to be sent or executed.

*   If this parameter is empty, the command is executed normally.
*   InstanceNotExists: The specified server does not exist or is released.
*   InstanceReleased: The server was released while the command was being executed on the server.
*   InstanceNotRunning: The server is not in the Running state while the command is being executed.
*   CommandNotApplicable: The command is not applicable to the specified server.
*   AccountNotExists: The specified account does not exist.
*   DirectoryNotExists: The specified directory does not exist.
*   BadCronExpression: The specified cron expression for the execution schedule is invalid.
*   ClientNotRunning: The Cloud Assistant client is not running.
*   ClientNotResponse: The Cloud Assistant client does not respond.
*   ClientIsUpgrading: The Cloud Assistant client is being upgraded.
*   ClientNeedUpgrade: The Cloud Assistant client needs to be upgraded.
*   DeliveryTimeout: Command sending times out.
*   ExecutionTimeout: The execution times out.
*   ExecutionException: An exception occurs while the command is being executed.
*   ExecutionInterrupted: The execution is interrupted.
*   ExitCodeNonzero: The execution is complete, but the exit code is not 0.', example='InstanceNotExists'),
    errorInfo?: string(name='ErrorInfo', description='The error message returned when the command is not successfully sent or executed. Valid values:

*   If this parameter is empty, the command is executed normally.
*   the specified instance does not exists: The specified server does not exist or is released.
*   the instance has released when create task: The server was released while the command was being executed on the server.
*   the instance is not running when create task: The server is not in the Running state while the command is being executed.
*   the command is not applicable: The command is not applicable to the specified server.
*   the specified account does not exists: The specified account does not exist.
*   the specified directory does not exists: The specified directory does not exist.
*   the cron job expression is invalid: The specified cron expression is invalid.
*   the aliyun service is not running on the instance: The Cloud Assistance client is not running.
*   the aliyun service in the instance does not response: The Cloud Assistant client does not respond to your request.
*   the aliyun service in the instance is upgrading now: The Cloud Assistant client is being upgraded.
*   the aliyun service in the instance need upgrade: The Cloud Assistant client needs to be upgraded.
*   the command delivery has been timeout: Command sending times out.
*   the command execution has been timeout: The execution times out.
*   the command execution got an exception: An exception occurs while the command is being executed.
*   the command execution has been interrupted: The execution is interrupted.
*   the command execution exit code is not zero: The execution is complete, and the exit code is not 0.', example='the specified instance does not exists'),
    exitCode?: long(name='ExitCode', description='The exit code of the command.

*   For Linux instances, the exit code is the exit code of the shell command.
*   For Windows instances, the exit code is the exit code of the batch or PowerShell command.', example='0'),
    finishedTime?: string(name='FinishedTime', description='The time when the execution ended.', example='2022-07-11T06:37:17Z'),
    instanceId?: string(name='InstanceId', description='The ID of the simple application server.', example='ace0706b2ac4454d984295a94213****'),
    invocationStatus?: string(name='InvocationStatus', description='The status of the execution progress. Valid values:

*   Pending: The command is being verified or sent.
*   Invalid: The specified command type or parameter is invalid.
*   Aborted: The command fails to be sent to the server. To send a command to a server, make sure that the server is in the Running state and the command can be sent within 1 minute.
*   Running: The command is being executed on the server.
*   Success: The execution is completed, and the exit code is 0.
*   Failed: The execution is completed, and the exit code is not 0.
*   Error: The execution cannot proceed due to an exception.
*   Timeout: The execution times out.
*   Cancelled: The execution is canceled, and the command is not executed.
*   Stopping: The command in the Running state is being stopped.
*   Terminated: The command is terminated while it is being executed.', example='Success'),
    invokeId?: string(name='InvokeId', description='The execution ID.', example='t-bj02prjje65****'),
    invokeRecordStatus?: string(name='InvokeRecordStatus', description='The status of the execution. Valid values:

*   Running
*   Finished
*   Failed
*   Stopped', example='Finished'),
    invokeUser?: string(name='InvokeUser', description='The username who executes the command on the simple application server.', example='root'),
    output?: string(name='Output', description='The command output.', example='YWRtaW4K'),
    startTime?: string(name='StartTime', description='The time when the execution started.', example='2022-07-11T06:37:16Z'),
  }(name='InvocationResult', description='The execution results.'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
}

model DescribeInvocationResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeInvocationResultResponseBody(name='body'),
}

/**
 * @summary Queries the execution result of a command.
 *
 * @description *   After you execute a command, the command may not succeed or return the expected results. You can call this operation to query the execution result of a command.
 * *   You can query the execution results that were generated within the last two weeks. A maximum of 100,000 entries of execution results can be retained.
 *
 * @param request DescribeInvocationResultRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeInvocationResultResponse
 */
async function describeInvocationResultWithOptions(request: DescribeInvocationResultRequest, runtime: Util.RuntimeOptions): DescribeInvocationResultResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.invokeId)) {
    query['InvokeId'] = request.invokeId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeInvocationResult',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the execution result of a command.
 *
 * @description *   After you execute a command, the command may not succeed or return the expected results. You can call this operation to query the execution result of a command.
 * *   You can query the execution results that were generated within the last two weeks. A maximum of 100,000 entries of execution results can be retained.
 *
 * @param request DescribeInvocationResultRequest
 * @return DescribeInvocationResultResponse
 */
async function describeInvocationResult(request: DescribeInvocationResultRequest): DescribeInvocationResultResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInvocationResultWithOptions(request, runtime);
}

model DescribeInvocationsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='3a658ca270df4df39f22e289b338****'),
  invokeStatus?: string(name='InvokeStatus', description='The status of the command execution. Valid values:

*   Running: The command is being executed.
*   Finished: The execution is complete.
*   Failed: The execution fails.', example='Finished'),
  pageNumber?: int32(name='PageNumber', description='The page number.

Pages start from page 1.

Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.

Maximum value: 50.

Default value: 10.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeInvocationsResponseBody = {
  invocations?: [ 
    {
      commandContent?: string(name='CommandContent', description='The content of the command, which is Base64-encoded.', example='bHM='),
      commandName?: string(name='CommandName', description='The name of the command.', example='testname'),
      commandType?: string(name='CommandType', description='The type of the command. Valid values:

*   RunBatScript: batch command (applicable to Windows instances).
*   RunPowerShellScript: PowerShell command (applicable to Windows instances).
*   RunShellScript: shell command (applicable to Linux instances).', example='RunShellScript'),
      creationTime?: string(name='CreationTime', description='The time when the command was created.', example='2022-07-11T06:37:16Z'),
      invocationStatus?: string(name='InvocationStatus', description='The status of the command. Valid values:

*   Pending: The command is being verified or sent.
*   Invalid: The specified command type or parameter is invalid.
*   Aborted: The command failed to be sent. To send a command to an instance, make sure that the instance is in the Running state and the command is sent to the instance within 1 minute.
*   Running: The command is being run on the instance.
*   Success: The command finishes running, and the exit code is 0.
*   Failed: The command finishes running, but the exit code is not 0.
*   Error: The running of the command cannot proceed due to an exception.
*   Timeout: The running of the command times out.
*   Cancelled: The running is canceled, and the command is not run.
*   Stopping: The command that is running is being stopped.
*   Terminated: The command is terminated while it is being run.', example='Success'),
      invokeId?: string(name='InvokeId', description='The ID of the command task.', example='t-hz02p9545t6****'),
      invokeStatus?: string(name='InvokeStatus', description='The status of the command. Valid values:

*   Running: The command is running.
*   Finished: The command finishes running.
*   Failed: The running of the command failed.
*   Stopped: The running is stopped.', example='Finished'),
      parameters?: map[string]any(name='Parameters', description='The custom parameters in the command. If no custom parameter exists in the command, the default value is {}.', example='{}'),
    }
  ](name='Invocations', description='The command name.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='10'),
}

model DescribeInvocationsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeInvocationsResponseBody(name='body'),
}

/**
 * @summary Queries details about command execution.
 *
 * @description *   After you execute a command, the command may not succeed or return the expected results. You can call this operation to query the actual execution results.
 * *   You can query the execution results that were generated within the last two weeks. Up to 100,000 entries of execution results can be retained.
 *
 * @param request DescribeInvocationsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeInvocationsResponse
 */
async function describeInvocationsWithOptions(request: DescribeInvocationsRequest, runtime: Util.RuntimeOptions): DescribeInvocationsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.invokeStatus)) {
    query['InvokeStatus'] = request.invokeStatus;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeInvocations',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries details about command execution.
 *
 * @description *   After you execute a command, the command may not succeed or return the expected results. You can call this operation to query the actual execution results.
 * *   You can query the execution results that were generated within the last two weeks. Up to 100,000 entries of execution results can be retained.
 *
 * @param request DescribeInvocationsRequest
 * @return DescribeInvocationsResponse
 */
async function describeInvocations(request: DescribeInvocationsRequest): DescribeInvocationsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeInvocationsWithOptions(request, runtime);
}

model DescribeMonitorDataRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  endTime?: string(name='EndTime', description='The end of the time range to query. The following formats are supported:

*   UNIX timestamp: the number of milliseconds that have elapsed since 00:00:00 January 1, 1970.
*   Time format: YYYY-MM-DDThh:mm:ssZ.

> The interval between the start time and the end time is less than or equal to 31 days.

This parameter is required.', example='2022-09-08T08:04:44Z'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='2ad1ae67295445f598017499dc****'),
  length?: string(name='Length', description='The number of entries per page. Valid values: 1 to 1440.', example='100'),
  metricName?: string(name='MetricName', description='The name of the metric. Valid values:

*   MEMORY_ACTUALUSEDSPACE: the memory usage. Unit: bytes.
*   DISKUSAGE_USED: the disk usage. Unit: bytes.
*   CPU_UTILIZATION: the CPU usage, in percentage.
*   VPC_PUBLICIP_INTERNETOUT_RATE: the outbound bandwidth. Unit: bits/s.
*   VPC_PUBLICIP_INTERNETIN_RATE: the inbound bandwidth. Unit: bits/s.
*   DISK_READ_IOPS: the read IOPS of the disk. Unit: count/s.
*   DISK_WRITE_IOPS: the write IOPS of the disk. Unit: count/s.
*   FLOW_USED: the traffic usage. Unit: bytes.

This parameter is required.', example='DISKUSAGE_USED'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request. You must specify the token that is obtained from the previous query as the value of NextToken.', example='AAAAAV3MpHK1AP0pfERHZN5pu6nOc1nj4M9UaAZ/I8db***'),
  period?: string(name='Period', description='The interval at which the monitoring data is queried. Valid values: 60, 300, and 900. Unit: seconds.

>  If MetricName is set to FLOW_USED, set Period to 3600 (one hour). In other cases, set Period based on your business requirements.

This parameter is required.', example='60'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. The following formats are supported:

*   UNIX timestamp: the number of milliseconds that have elapsed since 00:00:00 January 1, 1970.
*   Time format: YYYY-MM-DDThh:mm:ssZ.
> 
> - The specified time range includes the end time and excludes the start time. The start time must be earlier than the end time.
> - The interval between the start time and the end time is less than or equal to 31 days.

This parameter is required.', example='2022-09-07T04:04:44Z'),
}

model DescribeMonitorDataResponseBody = {
  datapoints?: string(name='Datapoints', description='The monitoring data.', example='[]'),
  nextToken?: string(name='NextToken', description='A pagination token. It can be used in the next request to retrieve a new page of results. If NextToken is empty, no next page exists.', example='AAAAAV3MpHK1AP0pfERHZN5pu6nOc1nj4M9UaAZ/I8db***'),
  period?: string(name='Period', description='The interval at which the monitoring data is queried. Valid values: 60, 300, and 900. Unit: seconds.

>  If you set the MetricName request parameter to FLOW_USED, the value of Period is 3600 (one hour).', example='60'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model DescribeMonitorDataResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeMonitorDataResponseBody(name='body'),
}

/**
 * @summary Queries the monitoring information about vCPUs, memory, disk IOPS, and traffic of a simple application server.
 *
 * @param request DescribeMonitorDataRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeMonitorDataResponse
 */
async function describeMonitorDataWithOptions(request: DescribeMonitorDataRequest, runtime: Util.RuntimeOptions): DescribeMonitorDataResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.length)) {
    query['Length'] = request.length;
  }
  if (!Util.isUnset(request.metricName)) {
    query['MetricName'] = request.metricName;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.period)) {
    query['Period'] = request.period;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeMonitorData',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the monitoring information about vCPUs, memory, disk IOPS, and traffic of a simple application server.
 *
 * @param request DescribeMonitorDataRequest
 * @return DescribeMonitorDataResponse
 */
async function describeMonitorData(request: DescribeMonitorDataRequest): DescribeMonitorDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeMonitorDataWithOptions(request, runtime);
}

model DescribeSecurityAgentStatusRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeSecurityAgentStatusResponseBody = {
  clientStatus?: string(name='ClientStatus', description='The status of the Security Center agent. Valid values:

*   pause: The Security Center agent suspends protection for your server.
*   online: The Security Center agent is protecting your server.
*   offline: The Security Center agent does not protect your server.', example='online'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model DescribeSecurityAgentStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSecurityAgentStatusResponseBody(name='body'),
}

/**
 * @summary Queries the status of the Security Center agent on a simple application server.
 *
 * @param request DescribeSecurityAgentStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSecurityAgentStatusResponse
 */
async function describeSecurityAgentStatusWithOptions(request: DescribeSecurityAgentStatusRequest, runtime: Util.RuntimeOptions): DescribeSecurityAgentStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSecurityAgentStatus',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the status of the Security Center agent on a simple application server.
 *
 * @param request DescribeSecurityAgentStatusRequest
 * @return DescribeSecurityAgentStatusResponse
 */
async function describeSecurityAgentStatus(request: DescribeSecurityAgentStatusRequest): DescribeSecurityAgentStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSecurityAgentStatusWithOptions(request, runtime);
}

model DetachKeyPairRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceIds?: [ string ](name='InstanceIds', description='The IDs of the simple application servers from which you want to unbind SSH key pairs. You can specify a maximum of 50 IDs of simple application servers.

This parameter is required.'),
  keyPairName?: string(name='KeyPairName', description='The name of the key pair. The name must be globally unique. The name must be 2 to 64 characters in length and can contain letters, digits, colons (:), underscores (_), and hyphens (-). The name must start with a letter but cannot start with http:// or https://.

This parameter is required.', example='KeyPairName'),
  regionId?: string(name='RegionId', description='The region ID of the simple application servers.

This parameter is required.', example='cn-hangzhou'),
}

model DetachKeyPairResponseBody = {
  failCount?: int32(name='FailCount', description='The total number of simple application servers from which you fail to unbind key pairs.', example='0'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
  results?: [ 
    {
      code?: string(name='Code', description='The HTTP status code.', example='200'),
      instanceId?: string(name='InstanceId', description='The ID of the simple application server.', example='aa6e71ddb35c46679bc4753d6219d604'),
      message?: string(name='Message', description='The response message.', example='success'),
      success?: string(name='Success', description='Indicates whether the key pair is unbound from the simple application server successfully. Valid values:

*   true
*   false', example='True'),
    }
  ](name='Results', description='The request results.'),
  totalCount?: int32(name='TotalCount', description='The total number of simple application servers from which the SSH key pair is unbound.', example='4'),
}

model DetachKeyPairResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DetachKeyPairResponseBody(name='body'),
}

/**
 * @summary Unbinds key pairs from simple application servers.
 *
 * @description If you want to change the SSH key pairs that are bound to your simple application servers or your end user no longer needs to access a specific simple application server, you can unbind the SSH key pairs from simple application servers to improve the security of the simple application servers or restrict access to the specific simple application server.
 *
 * @param request DetachKeyPairRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DetachKeyPairResponse
 */
async function detachKeyPairWithOptions(request: DetachKeyPairRequest, runtime: Util.RuntimeOptions): DetachKeyPairResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceIds)) {
    query['InstanceIds'] = request.instanceIds;
  }
  if (!Util.isUnset(request.keyPairName)) {
    query['KeyPairName'] = request.keyPairName;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DetachKeyPair',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Unbinds key pairs from simple application servers.
 *
 * @description If you want to change the SSH key pairs that are bound to your simple application servers or your end user no longer needs to access a specific simple application server, you can unbind the SSH key pairs from simple application servers to improve the security of the simple application servers or restrict access to the specific simple application server.
 *
 * @param request DetachKeyPairRequest
 * @return DetachKeyPairResponse
 */
async function detachKeyPair(request: DetachKeyPairRequest): DetachKeyPairResponse {
  var runtime = new Util.RuntimeOptions{};
  return detachKeyPairWithOptions(request, runtime);
}

model DisableFirewallRuleRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  remark?: string(name='Remark', description='The remarks of the firewall rule.', example='custom'),
  ruleId?: string(name='RuleId', description='The ID of the firewall rule. You can call the ListFirewallRules operation to query the ID of the firewall rule.

This parameter is required.', example='eeea34d9867b4d55a4ff8d5fcfbd****'),
}

model DisableFirewallRuleResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model DisableFirewallRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DisableFirewallRuleResponseBody(name='body'),
}

/**
 * @summary Disables a firewall rule of a simple application server.
 *
 * @param request DisableFirewallRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DisableFirewallRuleResponse
 */
async function disableFirewallRuleWithOptions(request: DisableFirewallRuleRequest, runtime: Util.RuntimeOptions): DisableFirewallRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.remark)) {
    query['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DisableFirewallRule',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Disables a firewall rule of a simple application server.
 *
 * @param request DisableFirewallRuleRequest
 * @return DisableFirewallRuleResponse
 */
async function disableFirewallRule(request: DisableFirewallRuleRequest): DisableFirewallRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return disableFirewallRuleWithOptions(request, runtime);
}

model EnableFirewallRuleRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='2ad1ae67295445f598017499dc****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  remark?: string(name='Remark', description='The remarks of the firewall rule.', example='custom'),
  ruleId?: string(name='RuleId', description='The ID of the firewall rule.

This parameter is required.', example='eeea34d9867b4d55a4ff8d5fcfbd****'),
  sourceCidrIp?: string(name='SourceCidrIp', description='The IP address or CIDR block that is allowed in the firewall policy.', example='10.147.33.**'),
}

model EnableFirewallRuleResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
}

model EnableFirewallRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: EnableFirewallRuleResponseBody(name='body'),
}

/**
 * @summary Enables a firewall rule for a simple application server.
 *
 * @param request EnableFirewallRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return EnableFirewallRuleResponse
 */
async function enableFirewallRuleWithOptions(request: EnableFirewallRuleRequest, runtime: Util.RuntimeOptions): EnableFirewallRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.remark)) {
    query['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  if (!Util.isUnset(request.sourceCidrIp)) {
    query['SourceCidrIp'] = request.sourceCidrIp;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'EnableFirewallRule',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Enables a firewall rule for a simple application server.
 *
 * @param request EnableFirewallRuleRequest
 * @return EnableFirewallRuleResponse
 */
async function enableFirewallRule(request: EnableFirewallRuleRequest): EnableFirewallRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return enableFirewallRuleWithOptions(request, runtime);
}

model ImportKeyPairRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  keyPairName?: string(name='KeyPairName', description='The name of the key pair. The name must be 2 to 64 characters in length and can contain letters, digits, colons (:), underscores (_), and hyphens (-). The name must start with a letter and cannot start with http:// or https://.

This parameter is required.', example='KeyPairName'),
  publicKeyBody?: string(name='PublicKeyBody', description='The public key of the key pair.

This parameter is required.', example='ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCbO5Govwhb0iHzoMYKkIQxjlHyHH8nxFsW6KF5saxgYhOwdeIpWngpi+/NDWQKvuOnXFFDh/o3eJJkh3rqP+RlMggt4HLQWOd9TS0f4/cgbAzud1caW9PnankCr****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model ImportKeyPairResponseBody = {
  keyPairName?: string(name='KeyPairName', description='The name of the key pair. The name must be 2 to 64 characters in length and can contain letters, digits, colons (:), underscores (_), and hyphens (-). The name must start with a letter and cannot start with http:// or https://.', example='KeyPairName'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model ImportKeyPairResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ImportKeyPairResponseBody(name='body'),
}

/**
 * @summary Imports an existing key pair to the Simple Application Server console.
 *
 * @description You can call this operation to import an existing key pair to the Simple Application Server console. This way, you can use the key pair to log on to simple application servers. The existing key pair that you want to import must use a supported encryption method. For more information, see [Q2: Which encryption methods must be used by key pairs when I import existing key pairs to the Simple Application Server console?](https://help.aliyun.com/document_detail/59085.html)
 *
 * @param request ImportKeyPairRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ImportKeyPairResponse
 */
async function importKeyPairWithOptions(request: ImportKeyPairRequest, runtime: Util.RuntimeOptions): ImportKeyPairResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.keyPairName)) {
    query['KeyPairName'] = request.keyPairName;
  }
  if (!Util.isUnset(request.publicKeyBody)) {
    query['PublicKeyBody'] = request.publicKeyBody;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ImportKeyPair',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Imports an existing key pair to the Simple Application Server console.
 *
 * @description You can call this operation to import an existing key pair to the Simple Application Server console. This way, you can use the key pair to log on to simple application servers. The existing key pair that you want to import must use a supported encryption method. For more information, see [Q2: Which encryption methods must be used by key pairs when I import existing key pairs to the Simple Application Server console?](https://help.aliyun.com/document_detail/59085.html)
 *
 * @param request ImportKeyPairRequest
 * @return ImportKeyPairResponse
 */
async function importKeyPair(request: ImportKeyPairRequest): ImportKeyPairResponse {
  var runtime = new Util.RuntimeOptions{};
  return importKeyPairWithOptions(request, runtime);
}

model InstallCloudAssistantRequest {
  instanceIds?: [ string ](name='InstanceIds', description='The IDs of the simple application servers.

This parameter is required.'),
  regionId?: string(name='RegionId', description='The region ID of the simple application servers. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model InstallCloudAssistantShrinkRequest {
  instanceIdsShrink?: string(name='InstanceIds', description='The IDs of the simple application servers.

This parameter is required.'),
  regionId?: string(name='RegionId', description='The region ID of the simple application servers. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model InstallCloudAssistantResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
}

model InstallCloudAssistantResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: InstallCloudAssistantResponseBody(name='body'),
}

/**
 * @summary Installs the Cloud Assistant client on simple application servers at a time.
 *
 * @description To run commands on your simple application servers, you must install the Cloud Assistant client on your servers. You can call the [DescribeCloudAssistantStatus](https://help.aliyun.com/document_detail/439512.html) operation to check whether the Cloud Assistant client is installed on your simple application servers. If you have not installed the Cloud Assistant client, you can call the InstallCloudAssistant operation to install the client. Then, you can call the [RebootInstance](https://help.aliyun.com/document_detail/190443.html) operation to restart the servers to allow the client to take effect.
 *
 * @param tmpReq InstallCloudAssistantRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return InstallCloudAssistantResponse
 */
async function installCloudAssistantWithOptions(tmpReq: InstallCloudAssistantRequest, runtime: Util.RuntimeOptions): InstallCloudAssistantResponse {
  Util.validateModel(tmpReq);
  var request = new InstallCloudAssistantShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.instanceIds)) {
    request.instanceIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.instanceIds, 'InstanceIds', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.instanceIdsShrink)) {
    query['InstanceIds'] = request.instanceIdsShrink;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'InstallCloudAssistant',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Installs the Cloud Assistant client on simple application servers at a time.
 *
 * @description To run commands on your simple application servers, you must install the Cloud Assistant client on your servers. You can call the [DescribeCloudAssistantStatus](https://help.aliyun.com/document_detail/439512.html) operation to check whether the Cloud Assistant client is installed on your simple application servers. If you have not installed the Cloud Assistant client, you can call the InstallCloudAssistant operation to install the client. Then, you can call the [RebootInstance](https://help.aliyun.com/document_detail/190443.html) operation to restart the servers to allow the client to take effect.
 *
 * @param request InstallCloudAssistantRequest
 * @return InstallCloudAssistantResponse
 */
async function installCloudAssistant(request: InstallCloudAssistantRequest): InstallCloudAssistantResponse {
  var runtime = new Util.RuntimeOptions{};
  return installCloudAssistantWithOptions(request, runtime);
}

model InstallCloudMonitorAgentRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  force?: boolean(name='Force', description='Specifies whether to forcibly install the CloudMonitor agent. Valid values:

*   true (default value): forcibly installs the CloudMonitor agent.
*   false: does not forcibly install the CloudMonitor agent.', example='true'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='9ae7106e68eb4402b0dcbd48a9de****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model InstallCloudMonitorAgentResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4****'),
}

model InstallCloudMonitorAgentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: InstallCloudMonitorAgentResponseBody(name='body'),
}

/**
 * @summary Installs the CloudMonitor agent for a simple application server.
 *
 * @param request InstallCloudMonitorAgentRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return InstallCloudMonitorAgentResponse
 */
async function installCloudMonitorAgentWithOptions(request: InstallCloudMonitorAgentRequest, runtime: Util.RuntimeOptions): InstallCloudMonitorAgentResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.force)) {
    query['Force'] = request.force;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'InstallCloudMonitorAgent',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Installs the CloudMonitor agent for a simple application server.
 *
 * @param request InstallCloudMonitorAgentRequest
 * @return InstallCloudMonitorAgentResponse
 */
async function installCloudMonitorAgent(request: InstallCloudMonitorAgentRequest): InstallCloudMonitorAgentResponse {
  var runtime = new Util.RuntimeOptions{};
  return installCloudMonitorAgentWithOptions(request, runtime);
}

model InvokeCommandRequest {
  commandId?: string(name='CommandId', description='The command ID. You can call the DescribeCommands operation to query all available command IDs.

This parameter is required.', example='c-sh02yh0932w****'),
  instanceIds?: string(name='InstanceIds', description='The IDs of the simple application servers. The value can be a JSON array that consists of up to 50 IDs of simple application servers. Separate multiple IDs with commas (,).

This parameter is required.', example='["2ad1ae67295445f598017499dc****", "2ad1ae67295445f598017123dc****"]'),
  parameters?: map[string]any(name='Parameters', description='The key-value pairs of custom parameters to specify when the custom parameter feature is enabled.

*   You can specify up to 10 custom parameters. Each key in a Map collection cannot be an empty string and can be up to 64 characters in length.
*   Values in a Map collection can be empty strings. The total length of the custom parameters and the original command cannot exceed 18 KB after they are encoded in Base64.
*   The custom parameter names that you specify for the Parameters parameter must be included in the custom parameter names that you specified when you created the command.
*   You can use empty strings to represent the custom parameters that are not specified. If you want to disable the custom parameter feature, you can leave this parameter empty.', example='{"delayed_insert_timeout":"600","max_length_for_sort_data":"2048"}'),
  regionId?: string(name='RegionId', description='The region ID. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  username?: string(name='Username', description='The name of the user who runs the command in a simple application server. The username cannot exceed 255 characters in length.

*   For Linux servers, the default value is the root username.
*   For Windows servers, the default value is the system username.

You can change the user to run the command only for Linux simple application servers.', example='test'),
}

model InvokeCommandShrinkRequest {
  commandId?: string(name='CommandId', description='The command ID. You can call the DescribeCommands operation to query all available command IDs.

This parameter is required.', example='c-sh02yh0932w****'),
  instanceIds?: string(name='InstanceIds', description='The IDs of the simple application servers. The value can be a JSON array that consists of up to 50 IDs of simple application servers. Separate multiple IDs with commas (,).

This parameter is required.', example='["2ad1ae67295445f598017499dc****", "2ad1ae67295445f598017123dc****"]'),
  parametersShrink?: string(name='Parameters', description='The key-value pairs of custom parameters to specify when the custom parameter feature is enabled.

*   You can specify up to 10 custom parameters. Each key in a Map collection cannot be an empty string and can be up to 64 characters in length.
*   Values in a Map collection can be empty strings. The total length of the custom parameters and the original command cannot exceed 18 KB after they are encoded in Base64.
*   The custom parameter names that you specify for the Parameters parameter must be included in the custom parameter names that you specified when you created the command.
*   You can use empty strings to represent the custom parameters that are not specified. If you want to disable the custom parameter feature, you can leave this parameter empty.', example='{"delayed_insert_timeout":"600","max_length_for_sort_data":"2048"}'),
  regionId?: string(name='RegionId', description='The region ID. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  username?: string(name='Username', description='The name of the user who runs the command in a simple application server. The username cannot exceed 255 characters in length.

*   For Linux servers, the default value is the root username.
*   For Windows servers, the default value is the system username.

You can change the user to run the command only for Linux simple application servers.', example='test'),
}

model InvokeCommandResponseBody = {
  invokeId?: string(name='InvokeId', description='The execution ID of the command.', example='t-bj02prjhw1n****'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
}

model InvokeCommandResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: InvokeCommandResponseBody(name='body'),
}

/**
 * @summary Runs a Command Assistant command for one or more simple application servers.
 *
 * @description *   The simple application servers for which you want to call the operation must meet the following conditions. If a simple application server cannot meet the conditions, you must call this operation again.
 *     *   The simple application servers are in the `Running` state. You can call the [ListInstances](https://help.aliyun.com/document_detail/2361065.html) operation to query the status of simple application servers.
 *     *   Cloud Assistant Agent is installed on the simple application servers. For more information, see [InstallCloudAssistant](https://help.aliyun.com/document_detail/2361030.html).
 *     *   If you run a PowerShell command, make sure that the PowerShell module is configured for the simple application servers.
 * *   The command may fail to be run due to the abnormal states of simple application servers, network exceptions, or exceptions in Cloud Assistant Agent. If the command fails to be run, no execution information is generated.
 * *   If you enable the custom parameter feature when you create a command, you must set the `Parameters` parameter to specify custom parameters when you run the command.
 * *   When you call this operation, you can select only one common command or a custom command that you have created.
 *
 * @param tmpReq InvokeCommandRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return InvokeCommandResponse
 */
async function invokeCommandWithOptions(tmpReq: InvokeCommandRequest, runtime: Util.RuntimeOptions): InvokeCommandResponse {
  Util.validateModel(tmpReq);
  var request = new InvokeCommandShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.parameters)) {
    request.parametersShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.parameters, 'Parameters', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.commandId)) {
    query['CommandId'] = request.commandId;
  }
  if (!Util.isUnset(request.instanceIds)) {
    query['InstanceIds'] = request.instanceIds;
  }
  if (!Util.isUnset(request.parametersShrink)) {
    query['Parameters'] = request.parametersShrink;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.username)) {
    query['Username'] = request.username;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'InvokeCommand',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Runs a Command Assistant command for one or more simple application servers.
 *
 * @description *   The simple application servers for which you want to call the operation must meet the following conditions. If a simple application server cannot meet the conditions, you must call this operation again.
 *     *   The simple application servers are in the `Running` state. You can call the [ListInstances](https://help.aliyun.com/document_detail/2361065.html) operation to query the status of simple application servers.
 *     *   Cloud Assistant Agent is installed on the simple application servers. For more information, see [InstallCloudAssistant](https://help.aliyun.com/document_detail/2361030.html).
 *     *   If you run a PowerShell command, make sure that the PowerShell module is configured for the simple application servers.
 * *   The command may fail to be run due to the abnormal states of simple application servers, network exceptions, or exceptions in Cloud Assistant Agent. If the command fails to be run, no execution information is generated.
 * *   If you enable the custom parameter feature when you create a command, you must set the `Parameters` parameter to specify custom parameters when you run the command.
 * *   When you call this operation, you can select only one common command or a custom command that you have created.
 *
 * @param request InvokeCommandRequest
 * @return InvokeCommandResponse
 */
async function invokeCommand(request: InvokeCommandRequest): InvokeCommandResponse {
  var runtime = new Util.RuntimeOptions{};
  return invokeCommandWithOptions(request, runtime);
}

model ListCustomImageShareAccountsRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure the idempotence of a request?](https://help.aliyun.com/document_detail/25693.html)', example='123e4567-e89b-12d3-a456-426655440000'),
  imageId?: string(name='ImageId', description='The ID of the shared custom image.

This parameter is required.', example='m-2zehv38jjmwva1ee****'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.

Maximum value: 50.

Default value: 10.', example='10'),
  regionId?: string(name='RegionId', description='The region ID. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model ListCustomImageShareAccountsResponseBody = {
  imageShareUsers?: [ 
    {
      sharedTime?: string(name='SharedTime', description='The time when the custom image is shared.', example='2024-07-15 13:59:21.0'),
      userId?: long(name='UserId', description='The ID of the Alibaba Cloud account whose custom image is shared.', example='125111425233****'),
    }
  ](name='ImageShareUsers', description='The information about the shared custom images.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='1'),
}

model ListCustomImageShareAccountsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListCustomImageShareAccountsResponseBody(name='body'),
}

/**
 * @summary Queries information about custom images that are shared across Alibaba Cloud accounts in a region.
 *
 * @param request ListCustomImageShareAccountsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListCustomImageShareAccountsResponse
 */
async function listCustomImageShareAccountsWithOptions(request: ListCustomImageShareAccountsRequest, runtime: Util.RuntimeOptions): ListCustomImageShareAccountsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.imageId)) {
    query['ImageId'] = request.imageId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListCustomImageShareAccounts',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries information about custom images that are shared across Alibaba Cloud accounts in a region.
 *
 * @param request ListCustomImageShareAccountsRequest
 * @return ListCustomImageShareAccountsResponse
 */
async function listCustomImageShareAccounts(request: ListCustomImageShareAccountsRequest): ListCustomImageShareAccountsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listCustomImageShareAccountsWithOptions(request, runtime);
}

model ListCustomImagesRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  dataSnapshotId?: string(name='DataSnapshotId', description='The ID of the data disk snapshot.', example='s-acscasca****'),
  imageIds?: string(name='ImageIds', description='The image IDs of the simple application server. The value can be a JSON array that consists of up to 100 image IDs. Separate multiple image IDs with commas (,).', example='["fe9c66133a9d4688872869726b52****", "794c230fd3e64ea19f83f4d7a0ad****"]'),
  imageNames?: string(name='ImageNames', description='The image names of the simple application servers. The value can be a JSON array that consists of up to 100 image names. Separate multiple image names with commas (,).', example='["test1****", "test2****"]'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server from which the image is derived.', example='ace0706b2ac4454d984295a94213****'),
  pageNumber?: int32(name='PageNumber', description='The page number. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.

*   Maximum value: 100.
*   Default value: 10.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the simple application servers corresponding to the custom images. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-aek2bti7cf7yj2i'),
  share?: boolean(name='Share', description='Specifies whether to query shared images. Valid values:

*   False: do not query shared images. The shared images are not included in the response.
*   True: query shared images. The shared images are included in the response.

If you do not specify this parameter, all images are returned.', example='False'),
  systemSnapshotId?: string(name='SystemSnapshotId', description='The ID of the system disk snapshot.', example='s-bp14m09pq8***0g6'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of tag N. A tag key can be 1 to 64 characters in length. Valid values of N: 1 to 20.', example='TestKey'),
      value?: string(name='Value', description='The value of tag N. A tag value can be up to 64 characters in length. Valid values of N: 1 to 20.', example='TestValue'),
    }
  ](name='Tag', description='Tag N of the custom image.'),
}

model ListCustomImagesResponseBody = {
  customImages?: [ 
    {
      createInstances?: [ string ](name='CreateInstances', description='The simple application servers created from the image.'),
      creationTime?: string(name='CreationTime', description='The time when the snapshot was created. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is in UTC.', example='2022-10-09T02:28:06Z'),
      dataSnapshotId?: string(name='DataSnapshotId', description='The ID of the data disk snapshot.', example='s-bp19rn9u8eqzlfb***'),
      dataSnapshotName?: string(name='DataSnapshotName', description='The name of the data disk snapshot.', example='data disk snapshot'),
      description?: string(name='Description', description='The description of the custom image.', example='test-custom-image'),
      imageId?: string(name='ImageId', description='The ID of the custom image.', example='m-bp1e79zktg26n2b***'),
      inShare?: boolean(name='InShare', description='Indicates whether the custom image is shared to Elastic Compute Service (ECS).', example='false'),
      inShareUser?: boolean(name='InShareUser', description='Indicates whether the custom image is shared across accounts.', example='False'),
      instanceId?: string(name='InstanceId', description='The ID of the simple application server from which the image is derived.', example='2d06ee0520b44de1ae88d4be****'),
      instanceName?: string(name='InstanceName', description='The name of the simple application server.', example='swas-asdf23***'),
      name?: string(name='Name', description='The name of the custom image.', example='hua'),
      osType?: string(name='OsType', description='The operating system type of the image.', example='Linux'),
      regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
      requiredDataDiskSize?: int32(name='RequiredDataDiskSize', description='The size of the image data disk. Unit: GiB.', example='20'),
      requiredSystemDiskSize?: int32(name='RequiredSystemDiskSize', description='The size of the image system disk. Unit: GiB.', example='20'),
      resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-acfm2h2lvp3ublq'),
      sourceImageName?: string(name='SourceImageName', description='The name of the source image that is used to create the simple application server.', example='CentOS'),
      sourceImageVersion?: string(name='SourceImageVersion', description='The version of the source image that is used to create the simple application server.', example='8.0'),
      status?: string(name='Status', description='The status of the custom image. Valid values:

*   0: copying
*   1: available
*   2: unavailable
*   3: creation failed
*   4: creating', example='1'),
      systemSnapshotId?: string(name='SystemSnapshotId', description='The ID of the system disk snapshot.', example='s-bp1h173hj21puxb***'),
      systemSnapshotName?: string(name='SystemSnapshotName', description='The name of the system disk snapshot.', example='system disk snapshot'),
      tags?: [ 
        {
          key?: string(name='Key', description='The tag key of the custom image.', example='TestKey'),
          value?: string(name='Value', description='The tag value of the custom image.', example='TestValue'),
        }
      ](name='Tags', description='The tags of the custom image.'),
      userId?: long(name='UserId', description='The ID of the Alibaba Cloud account to which the image belongs.', example='180185828710****'),
    }
  ](name='CustomImages', description='The array of queried custom images.'),
  pageNumber?: string(name='PageNumber', description='The page number.', example='1'),
  pageSize?: string(name='PageSize', description='The number of entries per page.', example='10'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
  totalCount?: string(name='TotalCount', description='The total number of entries returned.', example='4'),
}

model ListCustomImagesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListCustomImagesResponseBody(name='body'),
}

/**
 * @summary Queries the information about custom images in a region.
 *
 * @param request ListCustomImagesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListCustomImagesResponse
 */
async function listCustomImagesWithOptions(request: ListCustomImagesRequest, runtime: Util.RuntimeOptions): ListCustomImagesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.dataSnapshotId)) {
    query['DataSnapshotId'] = request.dataSnapshotId;
  }
  if (!Util.isUnset(request.imageIds)) {
    query['ImageIds'] = request.imageIds;
  }
  if (!Util.isUnset(request.imageNames)) {
    query['ImageNames'] = request.imageNames;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.share)) {
    query['Share'] = request.share;
  }
  if (!Util.isUnset(request.systemSnapshotId)) {
    query['SystemSnapshotId'] = request.systemSnapshotId;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListCustomImages',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information about custom images in a region.
 *
 * @param request ListCustomImagesRequest
 * @return ListCustomImagesResponse
 */
async function listCustomImages(request: ListCustomImagesRequest): ListCustomImagesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listCustomImagesWithOptions(request, runtime);
}

model ListDisksRequest {
  diskIds?: string(name='DiskIds', description='The IDs of the disks. The value can be a JSON array that consists of up to 100 disk IDs. Separate multiple disk IDs with commas (,).', example='["d-bp14wq0149cpp2x****", "d-bp14wq0149cpp2y****"]'),
  diskType?: string(name='DiskType', description='The disk type. Valid values:

*   system: system disk
*   data: data disk

By default, system disks and data disks are both queried.', example='System'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.', example='2ad1ae67295445f598017499dc****'),
  pageNumber?: int32(name='PageNumber', description='The page number.

Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.

Maximum value: 100.

Default value: 10.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the disks.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-aek2bti7cf7****'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key. The tag key can be up to 64 characters in length. Valid values of N: 1 to 20.', example='TestKey'),
      value?: string(name='Value', description='The tag value. The tag value can be up to 64 characters in length. Valid values of N: 1 to 20.', example='TestValue'),
    }
  ](name='Tag', description='The tags that are added to the disks.'),
}

model ListDisksResponseBody = {
  disks?: [ 
    {
      category?: string(name='Category', description='The category of the disk. Valid values:

*   ESSD: enhanced SSD (ESSD) of PL0
*   SSD: standard SSD
*   CLOUD_EFFICIENCY: ultra disk', example='ESSD'),
      creationTime?: string(name='CreationTime', description='The time when the disk was created. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2021-03-08T05:31:06Z'),
      device?: string(name='Device', description='The device name of the disk after the disk is attached to the simple application server.', example='/dev/xvda'),
      diskChargeType?: string(name='DiskChargeType', description='The billing method of the disk.', example='PrePaid'),
      diskId?: string(name='DiskId', description='The disk ID.', example='d-bp14wq0149cpp2x****'),
      diskName?: string(name='DiskName', description='The name of the disk.', example='SystemDisk'),
      diskType?: string(name='DiskType', description='The disk type. Valid values:

*   system: system disk
*   data: data disk', example='System'),
      instanceId?: string(name='InstanceId', description='The ID of the simple application server to which the disk is attached.', example='2ad1ae67295445f598017499dc****'),
      instanceName?: string(name='InstanceName', description='The name of the simple application server.', example='myInstance'),
      regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
      remark?: string(name='Remark', description='The remarks of the disk.', example='remark'),
      resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the disk belongs.', example='rg-aek2bti7cf7****'),
      size?: int32(name='Size', description='The size of the disk. Unit: GB.', example='50'),
      status?: string(name='Status', description='The status of the disk. Valid values:

*   ReIniting: The disk is being initialized.
*   Creating: The disk is being created.
*   In_use: The disk is in use.
*   Available: The disk can be attached.
*   Attaching: The disk is being attached.
*   Detaching: The disk is being detached.', example='In_use'),
      tags?: [ 
        {
          key?: string(name='Key', description='The tag key.', example='TestKey'),
          value?: string(name='Value', description='The tag value.', example='TestValue'),
        }
      ](name='Tags', description='The tags that are added to the disks.'),
    }
  ](name='Disks', description='The queried disks.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='1'),
}

model ListDisksResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDisksResponseBody(name='body'),
}

/**
 * @summary Queries the information about disks in a region.
 *
 * @description The `InstanceId`, `DiskIds`, and `ResourceGroupId` parameters are optional. However, you can specify them as filter conditions and combine them with the logical AND operator to filter disks that you want to query.
 *
 * @param request ListDisksRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDisksResponse
 */
async function listDisksWithOptions(request: ListDisksRequest, runtime: Util.RuntimeOptions): ListDisksResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.diskIds)) {
    query['DiskIds'] = request.diskIds;
  }
  if (!Util.isUnset(request.diskType)) {
    query['DiskType'] = request.diskType;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDisks',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information about disks in a region.
 *
 * @description The `InstanceId`, `DiskIds`, and `ResourceGroupId` parameters are optional. However, you can specify them as filter conditions and combine them with the logical AND operator to filter disks that you want to query.
 *
 * @param request ListDisksRequest
 * @return ListDisksResponse
 */
async function listDisks(request: ListDisksRequest): ListDisksResponse {
  var runtime = new Util.RuntimeOptions{};
  return listDisksWithOptions(request, runtime);
}

model ListFirewallRulesRequest {
  firewallRuleId?: string(name='FirewallRuleId', description='The ID of the firewall rule.', example='1a16263ab0f541288312a15fa64280de'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  pageNumber?: int32(name='PageNumber', description='The page number.

Pages start from page 1.

Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.

Maximum value: 100.

Default value: 10.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server.

This parameter is required.', example='cn-hangzhou'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key. A tag key must be 1 to 64 characters in length. You can add up to 20 tags.', example='TestKey'),
      value?: string(name='Value', description='The tag value. A tag value must be 1 to 64 characters in length. You can add up to 20 tags.', example='TestValue'),
    }
  ](name='Tag', description='The tags of the firewall rule.'),
}

model ListFirewallRulesResponseBody = {
  firewallRules?: [ 
    {
      policy?: string(name='Policy', description='The firewall policy. Valid values:

*   accept: Access is allowed.
*   drop: Access is refused.', example='accept'),
      port?: string(name='Port', description='The port range.', example='3306'),
      remark?: string(name='Remark', description='The remarks of the firewall rule.', example='TEST'),
      ruleId?: string(name='RuleId', description='The ID of the firewall rule.', example='eeea34d9867b4d55a4ff8d5fcfbd****'),
      ruleProtocol?: string(name='RuleProtocol', description='The transport layer protocol. Valid values:

*   TCP
*   UDP
*   TCP+UDP', example='TCP'),
      sourceCidrIp?: string(name='SourceCidrIp', description='The source CIDR block.', example='0.0.0.0/0'),
      tags?: [ 
        {
          key?: string(name='Key', description='The tag key.', example='TestKey'),
          value?: string(name='Value', description='The tag value.', example='TestValue'),
        }
      ](name='Tags', description='The tags of the firewall rule.'),
    }
  ](name='FirewallRules', description='Details of the firewall rules.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='4'),
}

model ListFirewallRulesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListFirewallRulesResponseBody(name='body'),
}

/**
 * @summary Queries the firewall rules of a simple application server.
 *
 * @description You can call the ListFirewallRules operation to query the firewall rule details of a simple application server, including the port range, firewall rule ID, and transport layer protocol.
 *
 * @param request ListFirewallRulesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListFirewallRulesResponse
 */
async function listFirewallRulesWithOptions(request: ListFirewallRulesRequest, runtime: Util.RuntimeOptions): ListFirewallRulesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.firewallRuleId)) {
    query['FirewallRuleId'] = request.firewallRuleId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListFirewallRules',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the firewall rules of a simple application server.
 *
 * @description You can call the ListFirewallRules operation to query the firewall rule details of a simple application server, including the port range, firewall rule ID, and transport layer protocol.
 *
 * @param request ListFirewallRulesRequest
 * @return ListFirewallRulesResponse
 */
async function listFirewallRules(request: ListFirewallRulesRequest): ListFirewallRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listFirewallRulesWithOptions(request, runtime);
}

model ListImagesRequest {
  imageIds?: string(name='ImageIds', description='The image IDs. The value can be a JSON array that consists of up to 50 image IDs. Format: `["xxx", "yyy", … "zzz"]`. Separate multiple image IDs with commas (,).', example='["fe9c66133a9d4688872869726b52****", "794c230fd3e64ea19f83f4d7a0ad****"]'),
  imageType?: string(name='ImageType', description='The type of the images. Valid values:

*   system: OS images
*   app: application images
*   custom: custom images', example='system'),
  regionId?: string(name='RegionId', description='The region ID of the images. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model ListImagesResponseBody = {
  images?: [ 
    {
      description?: string(name='Description', description='The description of the image.', example='Apps ImageOS ImageCustom Images
WordPress is a popular and powerful platform that allows you to build blogs and content management websites and implement custom features by using third-party templates and plug-ins. This WordPress image is built based on CentOS 7.9, PHP 7.4, MySQL 5.7, and Apache 2.4.'),
      imageId?: string(name='ImageId', description='The ID of the image.', example='794c230fd3e64ea19f83f4d7a0ad****'),
      imageName?: string(name='ImageName', description='The name of the image.', example='WordPress-4.8.1'),
      imageType?: string(name='ImageType', description='The type of the image. Valid values:

*   system
*   app
*   custom', example='app'),
      platform?: string(name='Platform', description='The operating system type of the image. Valid values:

*   Linux
*   Windows', example='Linux'),
    }
  ](name='Images', description='Details of the queried images.'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model ListImagesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListImagesResponseBody(name='body'),
}

/**
 * @summary Queries the information about images in a region.
 *
 * @description You can query details about one or more images in a specified region, including the IDs, names, and types of the images.
 *
 * @param request ListImagesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListImagesResponse
 */
async function listImagesWithOptions(request: ListImagesRequest, runtime: Util.RuntimeOptions): ListImagesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.imageIds)) {
    query['ImageIds'] = request.imageIds;
  }
  if (!Util.isUnset(request.imageType)) {
    query['ImageType'] = request.imageType;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListImages',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information about images in a region.
 *
 * @description You can query details about one or more images in a specified region, including the IDs, names, and types of the images.
 *
 * @param request ListImagesRequest
 * @return ListImagesResponse
 */
async function listImages(request: ListImagesRequest): ListImagesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listImagesWithOptions(request, runtime);
}

model ListInstancePlansModificationRequest {
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model ListInstancePlansModificationResponseBody = {
  plans?: [ 
    {
      bandwidth?: int32(name='Bandwidth', description='The peak bandwidth. Unit: Mbit/s.', example='3'),
      core?: int32(name='Core', description='The number of vCPUs.', example='2'),
      currency?: string(name='Currency', description='The unit of the plan price. Valid values:

*   CNY
*   USD', example='CNY'),
      diskSize?: int32(name='DiskSize', description='The disk size of the simple application server. Unit: GB.', example='40'),
      diskType?: string(name='DiskType', description='The category of the disk. Valid values:

*   SSD: standard SSD
*   ESSD: enhanced SSD', example='ESSD'),
      flow?: int32(name='Flow', description='The monthly data transfer quota. Unit: GB.', example='400'),
      memory?: int32(name='Memory', description='The memory size. Unit: GB.', example='1'),
      originPrice?: double(name='OriginPrice', description='The price of the plan.', example='60'),
      planId?: string(name='PlanId', description='The ID of the plan.', example='swas.s2.c2m1s40b3t04'),
      supportPlatform?: string(name='SupportPlatform', description='The operating system types supported by the plan.', example='["Linux","Windows"]'),
    }
  ](name='Plans', description='The operating system types supported by the plan.'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
}

model ListInstancePlansModificationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstancePlansModificationResponseBody(name='body'),
}

/**
 * @summary Queries the plans to which you can upgrade your simple application server.
 *
 * @description If the plan of your simple application server does not meet your business requirements, you can call the ListInstancePlansModification operation to obtain a list of plans that can be upgraded for your simple application server. Then, you can call the [UpgradeInstance](https://help.aliyun.com/document_detail/190445.html) operation to upgrade the plan.
 * >  We recommend that you create snapshots for the disks of your simple application server to back up data before you upgrade the plan. For more information, see [CreateSnapshot](https://help.aliyun.com/document_detail/190452.html).
 * For the precautions about plan upgrade, see [Upgrade a simple application server](https://help.aliyun.com/document_detail/61433.html).
 *
 * @param request ListInstancePlansModificationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstancePlansModificationResponse
 */
async function listInstancePlansModificationWithOptions(request: ListInstancePlansModificationRequest, runtime: Util.RuntimeOptions): ListInstancePlansModificationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstancePlansModification',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the plans to which you can upgrade your simple application server.
 *
 * @description If the plan of your simple application server does not meet your business requirements, you can call the ListInstancePlansModification operation to obtain a list of plans that can be upgraded for your simple application server. Then, you can call the [UpgradeInstance](https://help.aliyun.com/document_detail/190445.html) operation to upgrade the plan.
 * >  We recommend that you create snapshots for the disks of your simple application server to back up data before you upgrade the plan. For more information, see [CreateSnapshot](https://help.aliyun.com/document_detail/190452.html).
 * For the precautions about plan upgrade, see [Upgrade a simple application server](https://help.aliyun.com/document_detail/61433.html).
 *
 * @param request ListInstancePlansModificationRequest
 * @return ListInstancePlansModificationResponse
 */
async function listInstancePlansModification(request: ListInstancePlansModificationRequest): ListInstancePlansModificationResponse {
  var runtime = new Util.RuntimeOptions{};
  return listInstancePlansModificationWithOptions(request, runtime);
}

model ListInstanceStatusRequest {
  instanceIds?: string(name='InstanceIds', description='The IDs of the simple application servers. The value can be a JSON array that consists of up to 100 simple application server IDs. Separate multiple server IDs with commas (,).', example='["2ad1ae67295445f598017499dc****", "2ad1ae67295445f598017123dc****"]'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the simple application servers. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model ListInstanceStatusResponseBody = {
  instanceStatuses?: [ 
    {
      instanceId?: string(name='InstanceId', description='The ID of the simple application server.', example='a9a6474b935d41bcb531250bb5d****'),
      status?: string(name='Status', description='The status of the simple application server. Valid values:

*   Pending
*   Starting
*   Running
*   Stopping
*   Stopped
*   Resetting
*   Upgrading
*   Disabled', example='Running'),
    }
  ](name='InstanceStatuses', description='The ID of the simple application server.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='54'),
}

model ListInstanceStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstanceStatusResponseBody(name='body'),
}

/**
 * @summary Queries the status of simple application servers.
 *
 * @param request ListInstanceStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstanceStatusResponse
 */
async function listInstanceStatusWithOptions(request: ListInstanceStatusRequest, runtime: Util.RuntimeOptions): ListInstanceStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceIds)) {
    query['InstanceIds'] = request.instanceIds;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstanceStatus',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the status of simple application servers.
 *
 * @param request ListInstanceStatusRequest
 * @return ListInstanceStatusResponse
 */
async function listInstanceStatus(request: ListInstanceStatusRequest): ListInstanceStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return listInstanceStatusWithOptions(request, runtime);
}

model ListInstancesRequest {
  chargeType?: string(name='ChargeType', description='The billing method of the simple application servers. Set the value to PrePaid, which indicates the subscription billing method.

Default value: PrePaid.', example='PrePaid'),
  instanceIds?: string(name='InstanceIds', description='The IDs of the simple application servers. The value can be a JSON array that consists of up to 100 simple application server IDs. Separate multiple server IDs with commas (,).

> If you specify both `InstanceIds` and `PublicIpAddresses`, make sure that the specified IDs and the specified public IP addresses belong to the same simple application servers. Otherwise, an empty result is returned.', example='["2ad1ae67295445f598017499dc****", "2ad1ae67295445f598017123dc****"]'),
  instanceName?: string(name='InstanceName', description='The name of the simple application server. Fuzzy search with the asterisk (\\\\*) wildcard is supported.', example='test'),
  pageNumber?: int32(name='PageNumber', description='The page number.

Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Maximum value: 100.

Default value: 10.', example='10'),
  planType?: string(name='PlanType'),
  publicIpAddresses?: string(name='PublicIpAddresses', description='The public IP addresses of the simple application servers. The value can be a JSON array that consists of up to 100 IP addresses. Separate multiple IP addresses with commas (,).

> If you specify both `InstanceIds` and `PublicIpAddresses`, make sure that the specified IDs and the specified public IP addresses belong to the same simple application servers. Otherwise, an empty result is returned.', example='["``42.1.**.**``", "``42.2.**.**``"]'),
  regionId?: string(name='RegionId', description='The region ID of the simple application servers.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the simple application servers belong.', example='rg-aek2bti7cf7****'),
  status?: string(name='Status', description='The status of the simple application servers. Valid values:

*   Pending
*   Starting
*   Running
*   Stopping
*   Stopped
*   Resetting
*   Upgrading
*   Disabled', example='Running'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key of the simple application servers. A tag key can be 1 to 64 characters in length. Valid values of N: 1 to 20.', example='test'),
      value?: string(name='Value', description='The tag value of the simple application servers. A tag value can be 1 to 64 characters in length. Valid values of N: 1 to 20.', example='01'),
    }
  ](name='Tag', description='The tags that are added to the simple application servers.'),
}

model ListInstancesResponseBody = {
  instances?: [ 
    {
      businessStatus?: string(name='BusinessStatus', description='The status of the server. Valid values:

*   Normal: The server is normal.
*   Expired: The server expires.
*   Overdue: The payment of the server is overdue.', example='Normal'),
      chargeType?: string(name='ChargeType', description='The billing method of the simple application server.', example='PrePaid'),
      combination?: boolean(name='Combination', description='Indicates whether the simple application server uses a bundle plan.', example='false'),
      combinationInstanceId?: string(name='CombinationInstanceId', description='The ID of the simple application server that uses a bundle plan.', example='com-f6c9a22****45b5b8de68ad608af1ba'),
      creationTime?: string(name='CreationTime', description='The time when the simple application server was created. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2021-03-08T05:31:06Z'),
      ddosStatus?: string(name='DdosStatus', description='The DDoS protection status of the server. Valid values:

*   Normal: The DDoS protection status of the server is normal.
*   BlackHole: The server is in blackhole filtering.
*   Defense: The server is being scrubbed.', example='Normal'),
      disableReason?: string(name='DisableReason', description='The reason why the server is disabled. Valid values:

*   FINANCIAL: The server is locked due to overdue payments.
*   SECURITY: The server is locked for security reasons.
*   EXPIRED: The server is expired.', example='EXPIRED'),
      disks?: [ 
        {
          category?: string(name='Category', description='The category of the disk. Valid values:

*   ESSD: ESSD of PL0
*   SSD: standard SSD
*   CLOUD_EFFICIENCY: an ultra disk.', example='ESSD'),
          creationTime?: string(name='CreationTime', description='The time when the simple application server was created. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2023-02-24T02:20:10Z'),
          device?: string(name='Device', description='The device name of the disk after the disk is attached to the simple application server.', example='/dev/xvda'),
          diskChargeType?: string(name='DiskChargeType', description='The billing method of the disk.', example='PrePaid'),
          diskId?: string(name='DiskId', description='The disk ID.', example='d-bp14wq0149cpp2x****'),
          diskName?: string(name='DiskName', description='The disk name.', example='SystemDisk'),
          diskTags?: [ 
            {
              key?: string(name='Key', description='The tag key.', example='TestKey'),
              value?: string(name='Value', description='The tag value.', example='TestValue'),
            }
          ](name='DiskTags', description='The tags that are added to the disk.'),
          diskType?: string(name='DiskType', description='The type of the disk. Valid values:

*   system: system disk.
*   data: data disk.', example='system'),
          regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
          remark?: string(name='Remark', description='The remarks of the disk.', example='remark'),
          resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the disk belongs.', example='rg-aek2bti7cf7****'),
          size?: int32(name='Size', description='The size of the disk. Unit: GiB.', example='50'),
          status?: string(name='Status', description='The status of the disk. Valid values:

*   ReIniting: The disk is being initialized.
*   Creating: The disk is being created.
*   In_use: The disk is in use.
*   Available: The disk can be attached.
*   Attaching: The disk is being attached.
*   Detaching: The disk is being detached.', example='In_use'),
        }
      ](name='Disks', description='The information about the disks on the simple application server.'),
      expiredTime?: string(name='ExpiredTime', description='The time when the simple application server expires. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2021-05-08T16:00:00Z'),
      image?: {
        imageContact?: string(name='ImageContact', description='The image provider.', example='https://selfs****e.console.aliyun.com/ticket/createIndex'),
        imageIconUrl?: string(name='ImageIconUrl', description='The URL of the image icon.', example='https://img.alicdn.com/imgextra/i3/O****1vdh9651ReKqWNMI2I_!!6000000002136****-24-24.svg'),
        imageName?: string(name='ImageName', description='The name of the image.', example='test-custom-1686536882356'),
        imageType?: string(name='ImageType', description='The type of the image. Valid values:

*   system
*   app
*   custom', example='system'),
        imageVersion?: string(name='ImageVersion', description='The image tag.', example='V3.5'),
        osType?: string(name='OsType', description='The OS.', example='windows'),
      }(name='Image', description='The description of the image.'),
      imageId?: string(name='ImageId', description='The ID of the image.', example='fe9c66133a9d4688872869726b52****'),
      innerIpAddress?: string(name='InnerIpAddress', description='The private IP address of the simple application server.', example='172.26.XX.XX'),
      instanceId?: string(name='InstanceId', description='The ID of the simple application server.', example='2ad1ae67295445f598017499dc****'),
      instanceName?: string(name='InstanceName', description='The name of the simple application server.', example='test-InstanceName'),
      networkAttributes?: [ 
        {
          peakBandwidth?: int32(name='PeakBandwidth'),
          privateIpAddress?: string(name='PrivateIpAddress'),
          publicIpAddress?: string(name='PublicIpAddress'),
          publicIpDdosStatus?: string(name='PublicIpDdosStatus'),
        }
      ](name='NetworkAttributes'),
      planId?: string(name='PlanId', description='The ID of the instance plan.', example='swas.s2.c2m2s50b4t08'),
      planType?: string(name='PlanType'),
      publicIpAddress?: string(name='PublicIpAddress', description='The public IP address.', example='42.1.XX.XX'),
      regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
      resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the server belongs.', example='rg-aekz7jmhg5s****'),
      resourceSpec?: {
        bandwidth?: int32(name='Bandwidth', description='The bandwidth. Unit: Mbit/s.', example='5'),
        cpu?: int32(name='Cpu', description='The number of vCPUs of the simple application server.', example='2'),
        diskCategory?: string(name='DiskCategory', description='The category of the disk. Valid values:

*   ESSD: enhanced SSD (ESSD) of PL0
*   SSD: standard SSD
*   CLOUD_EFFICIENCY: ultra disk', example='cloud_efficiency'),
        diskSize?: int32(name='DiskSize', description='The size of the disk. Unit: GiB.', example='60'),
        flow?: double(name='Flow', description='The amount of the traffic.

*   A value of 0 indicates the traffic amount of a bandwidth-based simple application server.
*   A non-zero value indicates the traffic amount of a data transfer plan-based simple application server.', example='818'),
        memory?: double(name='Memory', description='The size of the memory. Unit: GiB.', example='2'),
      }(name='ResourceSpec', description='The specifications of the resources on the simple application server.'),
      status?: string(name='Status', description='The status of the simple application server. Valid values:

*   Pending: The server is being prepared.
*   Starting: The server is being started.
*   Running: The server is running.
*   Stopping: The server is being stopped.
*   Stopped: The server is stopped.
*   Resetting: The server is being reset.
*   Upgrading: The server is being upgraded.
*   Disabled: The server is not available.', example='Running'),
      tags?: [ 
        {
          key?: string(name='Key', description='The tag key of the simple application server.', example='TestKey'),
          value?: string(name='Value', description='The tag value of the simple application server.', example='TestValue'),
        }
      ](name='Tags', description='The tags that are added to the simple application server.'),
      uuid?: string(name='Uuid', description='The universally unique identifier (UUID) of the simple application server.', example='41f30524-5df7-49c9-9c6e-32****489001'),
    }
  ](name='Instances', description='Details about the queried simple application servers.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='1'),
}

model ListInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstancesResponseBody(name='body'),
}

/**
 * @summary Queries the information about simple application servers in a region.
 *
 * @description You can call this operation to query the details of simple application servers in a specified region, including the names, public IP addresses, internal IP addresses, creation time, and expiration time of the servers.
 *
 * @param request ListInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstancesResponse
 */
async function listInstancesWithOptions(request: ListInstancesRequest, runtime: Util.RuntimeOptions): ListInstancesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.chargeType)) {
    query['ChargeType'] = request.chargeType;
  }
  if (!Util.isUnset(request.instanceIds)) {
    query['InstanceIds'] = request.instanceIds;
  }
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.planType)) {
    query['PlanType'] = request.planType;
  }
  if (!Util.isUnset(request.publicIpAddresses)) {
    query['PublicIpAddresses'] = request.publicIpAddresses;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstances',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information about simple application servers in a region.
 *
 * @description You can call this operation to query the details of simple application servers in a specified region, including the names, public IP addresses, internal IP addresses, creation time, and expiration time of the servers.
 *
 * @param request ListInstancesRequest
 * @return ListInstancesResponse
 */
async function listInstances(request: ListInstancesRequest): ListInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listInstancesWithOptions(request, runtime);
}

model ListInstancesTrafficPackagesRequest {
  instanceIds?: string(name='InstanceIds', description='The IDs of the simple application servers. The value can be a JSON array that consists of up to 100 simple application server IDs. Separate multiple server IDs with commas (,).

This parameter is required.', example='["2ad1ae67295445f598017499dc******","2ad1ae67295445f598017499dc******"]'),
  regionId?: string(name='RegionId', description='The region ID of the simple application servers. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model ListInstancesTrafficPackagesResponseBody = {
  instanceTrafficPackageUsages?: [ 
    {
      instanceId?: string(name='InstanceId', description='The ID of the simple application server.', example='ccscqwqwqqqw****'),
      trafficOverflow?: long(name='TrafficOverflow', description='The data transfers that exceeds the quota of the data transfer plan in the current month. Unit: Byte.', example='0'),
      trafficPackageRemaining?: long(name='TrafficPackageRemaining', description='The unused quota of the data transfer plan in the current month. Unit: Byte.', example='10000'),
      trafficPackageTotal?: long(name='TrafficPackageTotal', description='The quota of the data transfer plan in the current month. Unit: Byte.

>  TrafficPackageTotal = TrafficUsed + TrafficPackageRemaining', example='20000'),
      trafficUsed?: long(name='TrafficUsed', description='The used quota of the data transfer plan in the current month. Unit: Byte.', example='10000'),
    }
  ](name='InstanceTrafficPackageUsages', description='The data transfers that exceed the quota of the data transfer plan in the current month. Unit: bytes.'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
}

model ListInstancesTrafficPackagesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstancesTrafficPackagesResponseBody(name='body'),
}

/**
 * @summary Queries the details about data transfer plans of simple application servers.
 *
 * @description You can query the details of data transfer plans of simple application servers, including the total quota, used quota, unused quota, and excess data transfers in the current month.
 * Simple Application Server provides data transfer plans that can be used to offset data transfer fees. You are charged for excess data transfers. Take note of the following items:
 * *   Only outbound data transfers of simple application servers over the Internet are calculated. Outbound data transfers include the data transfer quota and the excess data transfers beyond the quota. Inbound data transfers of simple application servers over the Internet are not calculated.
 * *   Outbound data transfers from simple application servers to other Alibaba Cloud services over the Internet first consume data transfer quotas. If the quotas are exhausted, you are charged for excess data transfers.
 * *   You are not charged for data transfers between simple application servers within the same virtual private cloud (VPC).
 * For more information, see [Quotas and billing of data transfers](https://help.aliyun.com/document_detail/86281.html).
 *
 * @param request ListInstancesTrafficPackagesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstancesTrafficPackagesResponse
 */
async function listInstancesTrafficPackagesWithOptions(request: ListInstancesTrafficPackagesRequest, runtime: Util.RuntimeOptions): ListInstancesTrafficPackagesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceIds)) {
    query['InstanceIds'] = request.instanceIds;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstancesTrafficPackages',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the details about data transfer plans of simple application servers.
 *
 * @description You can query the details of data transfer plans of simple application servers, including the total quota, used quota, unused quota, and excess data transfers in the current month.
 * Simple Application Server provides data transfer plans that can be used to offset data transfer fees. You are charged for excess data transfers. Take note of the following items:
 * *   Only outbound data transfers of simple application servers over the Internet are calculated. Outbound data transfers include the data transfer quota and the excess data transfers beyond the quota. Inbound data transfers of simple application servers over the Internet are not calculated.
 * *   Outbound data transfers from simple application servers to other Alibaba Cloud services over the Internet first consume data transfer quotas. If the quotas are exhausted, you are charged for excess data transfers.
 * *   You are not charged for data transfers between simple application servers within the same virtual private cloud (VPC).
 * For more information, see [Quotas and billing of data transfers](https://help.aliyun.com/document_detail/86281.html).
 *
 * @param request ListInstancesTrafficPackagesRequest
 * @return ListInstancesTrafficPackagesResponse
 */
async function listInstancesTrafficPackages(request: ListInstancesTrafficPackagesRequest): ListInstancesTrafficPackagesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listInstancesTrafficPackagesWithOptions(request, runtime);
}

model ListKeyPairsRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  keyPairName?: string(name='KeyPairName', description='The name of the AccessKey pair. The name must be 2 to 64 characters in length and can contain letters, digits, colons (:), underscores (_), and hyphens (-). The name must start with a letter and cannot start with http:// or https://.', example='KeyPairName'),
  pageNumber?: int32(name='PageNumber', description='The page number. Page starts from page 1. Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the simple application servers. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model ListKeyPairsResponseBody = {
  keyPairs?: [ 
    {
      creationTime?: string(name='CreationTime', description='The time when the AccessKey pair was created.', example='2024-05-06T02:28Z'),
      instanceIds?: [ string ](name='InstanceIds', description='The IDs of simple application servers. A maximum of 50 IDs of simple application servers can be returned.'),
      keyPairName?: string(name='KeyPairName', description='The name of the AccessKey pair. The name must be 2 to 64 characters in length and can contain letters, digits, colons (:), underscores (_), and hyphens (-). The name must start with a letter and cannot start with http:// or https://.', example='testKeyPairName'),
      publicKey?: string(name='PublicKey', description='The content of the public key.', example='ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCbO5Govwhb0iHzoMYKkIQxjlHyHH8nxFsW6KF5saxgYhOwdeIpWngpi+/NDWQKvuOnXFFDh/o3eJJkh3rqP+RlMggt4HLQWOd9TS0f4/cgbAzud1caW9PnankCr****'),
    }
  ](name='KeyPairs', description='Details about the queried AccessKey pairs.'),
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='3'),
}

model ListKeyPairsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListKeyPairsResponseBody(name='body'),
}

/**
 * @summary Queries the AccessKey pairs that are bound to simple application servers in a specific region.
 *
 * @param request ListKeyPairsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListKeyPairsResponse
 */
async function listKeyPairsWithOptions(request: ListKeyPairsRequest, runtime: Util.RuntimeOptions): ListKeyPairsResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListKeyPairs',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the AccessKey pairs that are bound to simple application servers in a specific region.
 *
 * @param request ListKeyPairsRequest
 * @return ListKeyPairsResponse
 */
async function listKeyPairs(request: ListKeyPairsRequest): ListKeyPairsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listKeyPairsWithOptions(request, runtime);
}

model ListPlansRequest {
  regionId?: string(name='RegionId', description='The region ID of the plans. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model ListPlansResponseBody = {
  plans?: [ 
    {
      bandwidth?: int32(name='Bandwidth', description='The peak bandwidth. Unit: Mbit/s.', example='3'),
      core?: int32(name='Core', description='The number of vCPUs.', example='2'),
      currency?: string(name='Currency', description='The unit of the plan price. Valid values:

*   CNY
*   USD

>  CNY is for the China site (aliyun.com). USD is for the international site (alibabacloud.com).', example='CNY'),
      diskSize?: int32(name='DiskSize', description='The size of the disk. Unit: GB.', example='40'),
      diskType?: string(name='DiskType', description='The category of the disk. Valid values:

*   SSD: standard SSDs
*   ESSD: enhanced SSDs', example='ESSD'),
      flow?: int32(name='Flow', description='The monthly data transfer quota. Unit: GB.', example='400'),
      ispType?: string(name='IspType'),
      memory?: float(name='Memory', description='The memory size. Unit: GB.', example='1'),
      originPrice?: string(name='OriginPrice', description='The monthly price of the plan.', example='60'),
      planId?: string(name='PlanId', description='The ID of the plan.', example='swas.s2.c2m1s40b3t04'),
      planType?: string(name='PlanType'),
      publicIpNum?: string(name='PublicIpNum'),
      supportPlatform?: string(name='SupportPlatform', description='The operating system types supported by the plan.', example='["Linux","Windows"]'),
      tags?: [ 
        {
          cnTitle?: string(name='CnTitle'),
          color?: string(name='Color'),
          enTitle?: string(name='EnTitle'),
        }
      ](name='Tags'),
    }
  ](name='Plans', description='Details about the plans.'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model ListPlansResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListPlansResponseBody(name='body'),
}

/**
 * @summary Queries all plans provided by Simple Application Server in a region.
 *
 * @description You can query the details of all plans provided by Simple Application Server in a region, including the IDs, prices, disk sizes, and disk categories of the plans.
 *
 * @param request ListPlansRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListPlansResponse
 */
async function listPlansWithOptions(request: ListPlansRequest, runtime: Util.RuntimeOptions): ListPlansResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListPlans',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries all plans provided by Simple Application Server in a region.
 *
 * @description You can query the details of all plans provided by Simple Application Server in a region, including the IDs, prices, disk sizes, and disk categories of the plans.
 *
 * @param request ListPlansRequest
 * @return ListPlansResponse
 */
async function listPlans(request: ListPlansRequest): ListPlansResponse {
  var runtime = new Util.RuntimeOptions{};
  return listPlansWithOptions(request, runtime);
}

model ListRegionsRequest {
  acceptLanguage?: string(name='AcceptLanguage', description='The language of the response. Valid values:

*   **zh-CN** (default): Chinese
*   **en-US**: English', example='zh-CN'),
}

model ListRegionsResponseBody = {
  regions?: [ 
    {
      localName?: string(name='LocalName', description='The name of the region.', example='China (hangzhou)'),
      regionEndpoint?: string(name='RegionEndpoint', description='The endpoint of the region.', example='swas.cn-hangzhou.aliyuncs.com'),
      regionId?: string(name='RegionId', description='The ID of the region.', example='cn-hangzhou'),
    }
  ](name='Regions', description='The regions.'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model ListRegionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListRegionsResponseBody(name='body'),
}

/**
 * @summary Queries all regions in which Simple Application Server is supported.
 *
 * @description The query results include all the Alibaba Cloud regions where Simple Application Server is supported on the international site (alibabacloud.com) and the China site (aliyun.com).
 *
 * @param request ListRegionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListRegionsResponse
 */
async function listRegionsWithOptions(request: ListRegionsRequest, runtime: Util.RuntimeOptions): ListRegionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.acceptLanguage)) {
    query['AcceptLanguage'] = request.acceptLanguage;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRegions',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries all regions in which Simple Application Server is supported.
 *
 * @description The query results include all the Alibaba Cloud regions where Simple Application Server is supported on the international site (alibabacloud.com) and the China site (aliyun.com).
 *
 * @param request ListRegionsRequest
 * @return ListRegionsResponse
 */
async function listRegions(request: ListRegionsRequest): ListRegionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listRegionsWithOptions(request, runtime);
}

model ListSnapshotsRequest {
  diskId?: string(name='DiskId', description='The disk ID.', example='d-bp14wq0149cpp2xy****'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.', example='2ad1ae67295445f598017499dc****'),
  pageNumber?: int32(name='PageNumber', description='The page number.

Default value: 1.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Maximum value: 100.

Default value: 10.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server that corresponds to the snapshots.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-aek2bti7cf7****'),
  snapshotIds?: string(name='SnapshotIds', description='The snapshot IDs. The value can be a JSON array that consists of up to 100 snapshot IDs. Separate multiple snapshot IDs with commas (,).', example='["s-bp16oazlsold4dks****", "s-bp16oazlsold4abc****"]'),
  sourceDiskType?: string(name='SourceDiskType', description='The type of the source disk. Valid values:

*   system: system disk.
*   data: data disk.', example='System'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of tag N that you want to add to the snapshot. A tag key can be 1 to 64 characters in length. Valid values of N: 1 to 20.', example='TestKey'),
      value?: string(name='Value', description='The value of tag N that you want to add to the snapshot. A tag value can be up to 64 characters in length. Valid values of N: 1 to 20.', example='TestValue'),
    }
  ](name='Tag', description='Tag N that you want to add to the snapshot.'),
}

model ListSnapshotsResponseBody = {
  pageNumber?: int32(name='PageNumber', description='The page number.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page.', example='10'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
  snapshots?: [ 
    {
      creationTime?: string(name='CreationTime', description='The time when the snapshot was created. The time follows the [ISO 8601](https://help.aliyun.com/document_detail/25696.html) standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.', example='2021-03-09T07:12:49Z'),
      instanceId?: string(name='InstanceId', description='The ID of the simple application server.

Note: This parameter has a value returned for only system disk snapshots.', example='2ad1ae67295445f598017499dc****'),
      progress?: string(name='Progress', description='The progress of snapshot creation.', example='100%'),
      regionId?: string(name='RegionId', description='The region ID.', example='cn-hangzhou'),
      remark?: string(name='Remark', description='The remarks of the snapshot.', example='test-Remark'),
      resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group to which the snapshot belongs.', example='rg-aek2bti7cf7****'),
      rollbackTime?: string(name='RollbackTime', description='The time when the last disk rollback was performed.', example='2021-03-09T07:12:49Z'),
      snapshotId?: string(name='SnapshotId', description='The snapshot ID.', example='s-bp16oazlsold4dks****'),
      snapshotName?: string(name='SnapshotName', description='The name of the snapshot.', example='test-SnapshotName'),
      sourceDiskId?: string(name='SourceDiskId', description='The ID of the source disk. This parameter has a value even after the source disk is released.', example='d-bp14wq0149cpp2xy****'),
      sourceDiskType?: string(name='SourceDiskType', description='The type of the source disk. Valid values:

*   system: system disk.
*   data: data disk.', example='System'),
      status?: string(name='Status', description='The status of the snapshot. Valid values:

*   Progressing: The snapshot is being created.
*   Accomplished: The snapshot is created.
*   Failed: The snapshot failed to be created.', example='Accomplished'),
      tags?: [ 
        {
          key?: string(name='Key', description='The tag key of the snapshot.', example='TestKey'),
          value?: string(name='Value', description='The tag value of the snapshot.', example='TestValue'),
        }
      ](name='Tags', description='The tags of the snapshot.'),
    }
  ](name='Snapshots', description='Details about the snapshots.'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='1'),
}

model ListSnapshotsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListSnapshotsResponseBody(name='body'),
}

/**
 * @summary Queries the information about snapshots that are created for a simple application server.
 *
 * @description The `InstanceId`, `DiskId`, `SnapshotIds`, and `ResourceGroupId` parameters are optional. However, you can specify them as filter conditions and combine them with the logical AND operator to filter snapshots that you want to query.
 *
 * @param request ListSnapshotsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListSnapshotsResponse
 */
async function listSnapshotsWithOptions(request: ListSnapshotsRequest, runtime: Util.RuntimeOptions): ListSnapshotsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.diskId)) {
    query['DiskId'] = request.diskId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.snapshotIds)) {
    query['SnapshotIds'] = request.snapshotIds;
  }
  if (!Util.isUnset(request.sourceDiskType)) {
    query['SourceDiskType'] = request.sourceDiskType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSnapshots',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the information about snapshots that are created for a simple application server.
 *
 * @description The `InstanceId`, `DiskId`, `SnapshotIds`, and `ResourceGroupId` parameters are optional. However, you can specify them as filter conditions and combine them with the logical AND operator to filter snapshots that you want to query.
 *
 * @param request ListSnapshotsRequest
 * @return ListSnapshotsResponse
 */
async function listSnapshots(request: ListSnapshotsRequest): ListSnapshotsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listSnapshotsWithOptions(request, runtime);
}

model ListTagResourcesRequest {
  clientToken?: string(name='ClientToken', description='The client token that you want to use to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [Ensure idempotence](https://help.aliyun.com/document_detail/25693.html)', example='123e4567-e89b-12d3-a456-426655440000'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='AAAAAV3MpHK1AP0pfERHZN5pu6nOc1nj4M9UaAZ/I8db***'),
  regionId?: string(name='RegionId', description='The region ID.

This parameter is required.', example='cn-hangzhou'),
  resourceId?: [ string ](name='ResourceId', description='The ID of the resource. You can specify up to 50 resource IDs.'),
  resourceType?: string(name='ResourceType', description='The resource type. Valid values:

*   instance
*   snapshot
*   customimage
*   command
*   firewallrule
*   disk

This parameter is required.', example='instance'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of the tag that you want to add to a resource. The tag key can be 1 to 64 characters in length.', example='TestKey'),
      value?: string(name='Value', description='The value of the tag that you want to add to a resource. The tag value can be 1 to 64 characters in length.', example='TestValue'),
    }
  ](name='Tag', description='The list of tags. You can specify up to 20 tags.'),
}

model ListTagResourcesResponseBody = {
  nextToken?: string(name='NextToken', description='A pagination token. It can be used in the next request to retrieve a new page of results. If NextToken is empty, no next page exists.', example='AAAAAV3MpHK1AP0pfERHZN5pu6nOc1nj4M9UaAZ/I8db***'),
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
  tagResources?: {
    tagResource?: [ 
    {
      resourceId?: string(name='ResourceId', description='The resource ID.', example='s-bw526m1vi6x20c6g****'),
      resourceType?: string(name='ResourceType', description='The type of the resource. Valid values:

*   instance
*   snapshot
*   customimage
*   command
*   firewallrule
*   disk', example='ALIYUN::SWAS::INSTANCE'),
      tagKey?: string(name='TagKey', description='The tag key.', example='TestKey'),
      tagValue?: string(name='TagValue', description='The tag value.', example='TestValue'),
    }
  ](name='TagResource')
  }(name='TagResources', description='A collection of resources and the tags of the resources. The information includes the resource IDs, resource types, and key-value pairs of tags.'),
}

model ListTagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagResourcesResponseBody(name='body'),
}

/**
 * @summary Queries the tags that are added to simple resources, such as instances, snapshots, disks, images, commands, and firewall rules.
 *
 * @param request ListTagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTagResourcesResponse
 */
async function listTagResourcesWithOptions(request: ListTagResourcesRequest, runtime: Util.RuntimeOptions): ListTagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTagResources',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Queries the tags that are added to simple resources, such as instances, snapshots, disks, images, commands, and firewall rules.
 *
 * @param request ListTagResourcesRequest
 * @return ListTagResourcesResponse
 */
async function listTagResources(request: ListTagResourcesRequest): ListTagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTagResourcesWithOptions(request, runtime);
}

model LoginInstanceRequest {
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='9ae7106e68eb4402b0dcbd48a9de****'),
  password?: string(name='Password', description='The password that corresponds to the username.

*   For a Linux server, you do not need to enter a password.
*   For a Windows server, enter the password that you set. If you have not set a password for the simple application server, set a password. For more information, see [Reset the password](https://help.aliyun.com/document_detail/60055.html).', example='Test****'),
  port?: int32(name='Port', description='The port number that is used to log on to the simple application server by using Workbench.

*   Linux servers: The default value is 22.
*   Windows servers: The default value is 3389.

>  If you want to connect to a server by using a custom port, you must modify the default remote connection port. For more information, see [Configure a custom remote connection port](https://help.aliyun.com/document_detail/2807402.html).', example='3389'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  username?: string(name='Username', description='The username of the simple application server.

*   For a Linux server, you do not need to enter a username.
*   For a Windows server, the default username `administrator` is used.', example='administrator'),
}

model LoginInstanceResponseBody = {
  redirectUrl?: string(name='RedirectUrl', description='The URL that you use to log on to the server.', example='https://ecs-workbench.aliyun.com/view/instance/single/gbktfz****'),
  requestId?: string(name='RequestId', description='The request ID.', example='C2DE174B-7196-5778-A00D-6EA2601B****'),
}

model LoginInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: LoginInstanceResponseBody(name='body'),
}

/**
 * @summary Logs on to a simple application server on Workbench.
 *
 * @description After you create a simple application server, you can log on to the simple application server to build environments and applications on the server.
 *
 * @param request LoginInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return LoginInstanceResponse
 */
async function loginInstanceWithOptions(request: LoginInstanceRequest, runtime: Util.RuntimeOptions): LoginInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.password)) {
    query['Password'] = request.password;
  }
  if (!Util.isUnset(request.port)) {
    query['Port'] = request.port;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.username)) {
    query['Username'] = request.username;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'LoginInstance',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Logs on to a simple application server on Workbench.
 *
 * @description After you create a simple application server, you can log on to the simple application server to build environments and applications on the server.
 *
 * @param request LoginInstanceRequest
 * @return LoginInstanceResponse
 */
async function loginInstance(request: LoginInstanceRequest): LoginInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return loginInstanceWithOptions(request, runtime);
}

model ModifyDatabaseInstanceDescriptionRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  databaseInstanceDescription?: string(name='DatabaseInstanceDescription', description='The description of the Simple Database Service instance.

This parameter is required.'),
  databaseInstanceId?: string(name='DatabaseInstanceId', description='The ID of the Simple Database Service instance.

This parameter is required.', example='db-38263fa955774501a2ae1bdaed6f****'),
  regionId?: string(name='RegionId', description='The region ID of the Simple Database Service instance. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model ModifyDatabaseInstanceDescriptionResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model ModifyDatabaseInstanceDescriptionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDatabaseInstanceDescriptionResponseBody(name='body'),
}

/**
 * @summary Modifies the description of a Simple Database Service instance.
 *
 * @description You can call this operation to modify the description of a Simple Database Service instance.
 * ### QPS limit
 * You can call this API operation up to 10 times per minute per account. Requests that exceed this limit are dropped and you may experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see [QPS limits](https://help.aliyun.com/document_detail/347607.html).
 *
 * @param request ModifyDatabaseInstanceDescriptionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDatabaseInstanceDescriptionResponse
 */
async function modifyDatabaseInstanceDescriptionWithOptions(request: ModifyDatabaseInstanceDescriptionRequest, runtime: Util.RuntimeOptions): ModifyDatabaseInstanceDescriptionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.databaseInstanceDescription)) {
    query['DatabaseInstanceDescription'] = request.databaseInstanceDescription;
  }
  if (!Util.isUnset(request.databaseInstanceId)) {
    query['DatabaseInstanceId'] = request.databaseInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyDatabaseInstanceDescription',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Modifies the description of a Simple Database Service instance.
 *
 * @description You can call this operation to modify the description of a Simple Database Service instance.
 * ### QPS limit
 * You can call this API operation up to 10 times per minute per account. Requests that exceed this limit are dropped and you may experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see [QPS limits](https://help.aliyun.com/document_detail/347607.html).
 *
 * @param request ModifyDatabaseInstanceDescriptionRequest
 * @return ModifyDatabaseInstanceDescriptionResponse
 */
async function modifyDatabaseInstanceDescription(request: ModifyDatabaseInstanceDescriptionRequest): ModifyDatabaseInstanceDescriptionResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyDatabaseInstanceDescriptionWithOptions(request, runtime);
}

model ModifyDatabaseInstanceParameterRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  databaseInstanceId?: string(name='DatabaseInstanceId', description='The ID of the Simple Database Service instance.

This parameter is required.', example='db-38263fa955774501a2ae1bdaed6f****'),
  forceRestart?: boolean(name='ForceRestart', description='Specifies whether to forcibly restart the instance after parameters are modified. Valid values:

*   true: forcibly restarts the instance. If a new parameter value takes effect only after the instance restarts, you must set this parameter to true. Otherwise, the new parameter value cannot take effect.
*   false: does not forcibly restart the instance.

Default value: false.', example='false'),
  parameters?: string(name='Parameters', description='The JSON strings that consist of instance parameters and the values of the instance parameters. The parameter values are of the string type. Format: {"Parameter name 1":"Parameter value 1","Parameter name 2":"Parameter value 2"...}.

This parameter is required.', example='{"delayed_insert_timeout":"600","max_length_for_sort_data":"2048"}'),
  regionId?: string(name='RegionId', description='The region ID of the Simple Database Service instance. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model ModifyDatabaseInstanceParameterResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model ModifyDatabaseInstanceParameterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDatabaseInstanceParameterResponseBody(name='body'),
}

/**
 * @summary After you create a Simple Database Service instance, you can view the parameters of the instance or modify the parameters of the instance based on your business requirements.
 *
 * @description After you create a Simple Database Service instance, you can view the parameters of the instance or modify the parameters of the instance based on your business requirements.
 * ### QPS limit
 * You can call this API operation up to 10 times per minute per account. Requests that exceed this limit are dropped and you may experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see [QPS limits](https://help.aliyun.com/document_detail/347607.html).
 *
 * @param request ModifyDatabaseInstanceParameterRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDatabaseInstanceParameterResponse
 */
async function modifyDatabaseInstanceParameterWithOptions(request: ModifyDatabaseInstanceParameterRequest, runtime: Util.RuntimeOptions): ModifyDatabaseInstanceParameterResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.databaseInstanceId)) {
    query['DatabaseInstanceId'] = request.databaseInstanceId;
  }
  if (!Util.isUnset(request.forceRestart)) {
    query['ForceRestart'] = request.forceRestart;
  }
  if (!Util.isUnset(request.parameters)) {
    query['Parameters'] = request.parameters;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyDatabaseInstanceParameter',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary After you create a Simple Database Service instance, you can view the parameters of the instance or modify the parameters of the instance based on your business requirements.
 *
 * @description After you create a Simple Database Service instance, you can view the parameters of the instance or modify the parameters of the instance based on your business requirements.
 * ### QPS limit
 * You can call this API operation up to 10 times per minute per account. Requests that exceed this limit are dropped and you may experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see [QPS limits](https://help.aliyun.com/document_detail/347607.html).
 *
 * @param request ModifyDatabaseInstanceParameterRequest
 * @return ModifyDatabaseInstanceParameterResponse
 */
async function modifyDatabaseInstanceParameter(request: ModifyDatabaseInstanceParameterRequest): ModifyDatabaseInstanceParameterResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyDatabaseInstanceParameterWithOptions(request, runtime);
}

model ModifyFirewallRuleRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  port?: string(name='Port', description='The port range. Valid values: 165535. Specify a port range in the format of \\\\<start port number>/\\\\<end port number>. Example: `1024/1055`, which indicates that the port range of 10241055.

This parameter is required.', example='3306'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  remark?: string(name='Remark', description='The remarks of the firewall rule.', example='custom'),
  ruleId?: string(name='RuleId', description='The ID of the firewall rule.

This parameter is required.', example='eeea34d9867b4d55a4ff8d5fcfbd****'),
  ruleProtocol?: string(name='RuleProtocol', description='The transport layer protocol. Valid values:

*   TCP: the TCP protocol
*   UDP: the UDP protocol
*   TCP+UDP: the TCP and UDP protocols

This parameter is required.', example='TCP'),
  sourceCidrIp?: string(name='SourceCidrIp', description='The IP address or CIDR block that is allowed in the firewall rule.', example='10.147.33.**'),
}

model ModifyFirewallRuleResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E1FEE'),
}

model ModifyFirewallRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyFirewallRuleResponseBody(name='body'),
}

/**
 * @summary Modifies the firewall rule of a simple application server.
 *
 * @param request ModifyFirewallRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyFirewallRuleResponse
 */
async function modifyFirewallRuleWithOptions(request: ModifyFirewallRuleRequest, runtime: Util.RuntimeOptions): ModifyFirewallRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.port)) {
    query['Port'] = request.port;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.remark)) {
    query['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  if (!Util.isUnset(request.ruleProtocol)) {
    query['RuleProtocol'] = request.ruleProtocol;
  }
  if (!Util.isUnset(request.sourceCidrIp)) {
    query['SourceCidrIp'] = request.sourceCidrIp;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyFirewallRule',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Modifies the firewall rule of a simple application server.
 *
 * @param request ModifyFirewallRuleRequest
 * @return ModifyFirewallRuleResponse
 */
async function modifyFirewallRule(request: ModifyFirewallRuleRequest): ModifyFirewallRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyFirewallRuleWithOptions(request, runtime);
}

model ModifyFirewallTemplateRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  description?: string(name='Description', description='The description of the firewall template.', example='test'),
  firewallTemplateId?: string(name='FirewallTemplateId', description='The ID of the firewall template.

This parameter is required.', example='ft-bcf1a7hrdq717****'),
  firewallTemplateRule?: [ 
    {
      firewallTemplateRuleId?: string(name='FirewallTemplateRuleId', description='The ID of the firewall rule.

This parameter is required.', example='eeea34d9867b4d55a4ff8d5fcfbd****'),
      port?: string(name='Port', description='The port range. Valid values: 1 to 65535. Specify a port range in the format of \\\\<start port number>/\\\\<end port number>. Example: `1024/1055`, which indicates that the port range of 1024 to 1055.

>  If you set RuleProtocol to ICMP, you must set Port to -1/-1.', example='8080'),
      remark?: string(name='Remark', description='The remarks of the firewall template rule.', example='test'),
      ruleProtocol?: string(name='RuleProtocol', description='The transport layer protocol that the rule supports. Valid values:

*   TCP
*   UDP
*   TCP+UDP
*   ICMP', example='TCP'),
      sourceCidrIp?: string(name='SourceCidrIp', description='The source address to which you want to grant access permissions. CIDR blocks and IPv4 addresses are supported.', example='0.0.0.0/0'),
    }
  ](name='FirewallTemplateRule', description='The firewall rule in the template.'),
  name?: string(name='Name', description='The name of the firewall template.', example='testName'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model ModifyFirewallTemplateResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model ModifyFirewallTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyFirewallTemplateResponseBody(name='body'),
}

/**
 * @summary Modifies the firewall rule in a firewall template. You can apply the new firewall rule to simple application servers.
 *
 * @description Modifying a firewall template does not affect the firewall rules that have been applied to simple application servers.
 *
 * @param request ModifyFirewallTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyFirewallTemplateResponse
 */
async function modifyFirewallTemplateWithOptions(request: ModifyFirewallTemplateRequest, runtime: Util.RuntimeOptions): ModifyFirewallTemplateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.firewallTemplateId)) {
    query['FirewallTemplateId'] = request.firewallTemplateId;
  }
  if (!Util.isUnset(request.firewallTemplateRule)) {
    query['FirewallTemplateRule'] = request.firewallTemplateRule;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyFirewallTemplate',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Modifies the firewall rule in a firewall template. You can apply the new firewall rule to simple application servers.
 *
 * @description Modifying a firewall template does not affect the firewall rules that have been applied to simple application servers.
 *
 * @param request ModifyFirewallTemplateRequest
 * @return ModifyFirewallTemplateResponse
 */
async function modifyFirewallTemplate(request: ModifyFirewallTemplateRequest): ModifyFirewallTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyFirewallTemplateWithOptions(request, runtime);
}

model ModifyImageShareStatusRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  imageId?: string(name='ImageId', description='The image ID.

This parameter is required.', example='m-saacssasc****'),
  operation?: string(name='Operation', description='Valid values:

*   Share
*   UnShare

This parameter is required.', example='Share'),
  regionId?: string(name='RegionId', description='The region ID of the custom image. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model ModifyImageShareStatusResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C****'),
}

model ModifyImageShareStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyImageShareStatusResponseBody(name='body'),
}

/**
 * @summary Shares or unshares a custom image to Elastic Compute Service (ECS).
 *
 * @description Custom images can be shared to ECS. If the configurations of your simple application server cannot meet your business requirements, or you want to deploy your business on ECS instances, you can share your custom image to ECS to transfer your business from Simple Application Server to ECS.
 * >  The region in which the shared image resides in ECS is the same as the region in which the custom image resides in Simple Application Server.
 * You can unshare a custom image based on your business requirements or when you want to delete the custom image. After you unshare a custom image, take note of the following items:
 * *   You cannot query or use the custom image by using the ECS console or API.
 * *   You cannot re-initialize the disks of the ECS instances that were created based on the shared image.
 *
 * @param request ModifyImageShareStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyImageShareStatusResponse
 */
async function modifyImageShareStatusWithOptions(request: ModifyImageShareStatusRequest, runtime: Util.RuntimeOptions): ModifyImageShareStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.imageId)) {
    query['ImageId'] = request.imageId;
  }
  if (!Util.isUnset(request.operation)) {
    query['Operation'] = request.operation;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyImageShareStatus',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Shares or unshares a custom image to Elastic Compute Service (ECS).
 *
 * @description Custom images can be shared to ECS. If the configurations of your simple application server cannot meet your business requirements, or you want to deploy your business on ECS instances, you can share your custom image to ECS to transfer your business from Simple Application Server to ECS.
 * >  The region in which the shared image resides in ECS is the same as the region in which the custom image resides in Simple Application Server.
 * You can unshare a custom image based on your business requirements or when you want to delete the custom image. After you unshare a custom image, take note of the following items:
 * *   You cannot query or use the custom image by using the ECS console or API.
 * *   You cannot re-initialize the disks of the ECS instances that were created based on the shared image.
 *
 * @param request ModifyImageShareStatusRequest
 * @return ModifyImageShareStatusResponse
 */
async function modifyImageShareStatus(request: ModifyImageShareStatusRequest): ModifyImageShareStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyImageShareStatusWithOptions(request, runtime);
}

model ModifyInstanceVncPasswordRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  vncPassword?: string(name='VncPassword', description='The VNC connection password.', example='***'),
}

model ModifyInstanceVncPasswordResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
}

model ModifyInstanceVncPasswordResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyInstanceVncPasswordResponseBody(name='body'),
}

/**
 * @summary Changes the VNC password of a simple application server.
 *
 * @param request ModifyInstanceVncPasswordRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyInstanceVncPasswordResponse
 */
async function modifyInstanceVncPasswordWithOptions(request: ModifyInstanceVncPasswordRequest, runtime: Util.RuntimeOptions): ModifyInstanceVncPasswordResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.vncPassword)) {
    query['VncPassword'] = request.vncPassword;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyInstanceVncPassword',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Changes the VNC password of a simple application server.
 *
 * @param request ModifyInstanceVncPasswordRequest
 * @return ModifyInstanceVncPasswordResponse
 */
async function modifyInstanceVncPassword(request: ModifyInstanceVncPasswordRequest): ModifyInstanceVncPasswordResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyInstanceVncPasswordWithOptions(request, runtime);
}

model RebootInstanceRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server.

This parameter is required.', example='cn-hangzhou'),
}

model RebootInstanceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
}

model RebootInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RebootInstanceResponseBody(name='body'),
}

/**
 * @summary Restarts a simple application server.
 *
 * @description *   Only simple application servers that are in the Running state can be restarted.
 * *   After you restart a simple application server, it enters the Starting state.
 *
 * @param request RebootInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RebootInstanceResponse
 */
async function rebootInstanceWithOptions(request: RebootInstanceRequest, runtime: Util.RuntimeOptions): RebootInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RebootInstance',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Restarts a simple application server.
 *
 * @description *   Only simple application servers that are in the Running state can be restarted.
 * *   After you restart a simple application server, it enters the Starting state.
 *
 * @param request RebootInstanceRequest
 * @return RebootInstanceResponse
 */
async function rebootInstance(request: RebootInstanceRequest): RebootInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return rebootInstanceWithOptions(request, runtime);
}

model RebootInstancesRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  forceReboot?: boolean(name='ForceReboot', description='Specifies whether to forcibly restart the servers. Valid values:

*   true: forcibly restarts the servers. This operation is equivalent to the typical power-off operation. Cache data that is not written to storage devices on the server will be lost.
*   false: normally restarts the instance.

Default value: false', example='false'),
  instanceIds?: string(name='InstanceIds', description='The IDs of the simple application servers. The value can be a JSON array that consists of up to 100 simple application server IDs. Separate multiple server IDs with commas (,).

This parameter is required.', example='["2ad1ae67295445f598017499dc****", "2ad1ae67295445f598017123dc****"]'),
  regionId?: string(name='RegionId', description='The region ID of the simple application servers. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model RebootInstancesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model RebootInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RebootInstancesResponseBody(name='body'),
}

/**
 * @summary Restarts simple application servers.
 *
 * @param request RebootInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RebootInstancesResponse
 */
async function rebootInstancesWithOptions(request: RebootInstancesRequest, runtime: Util.RuntimeOptions): RebootInstancesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.forceReboot)) {
    query['ForceReboot'] = request.forceReboot;
  }
  if (!Util.isUnset(request.instanceIds)) {
    query['InstanceIds'] = request.instanceIds;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RebootInstances',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Restarts simple application servers.
 *
 * @param request RebootInstancesRequest
 * @return RebootInstancesResponse
 */
async function rebootInstances(request: RebootInstancesRequest): RebootInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return rebootInstancesWithOptions(request, runtime);
}

model ReleasePublicConnectionRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  databaseInstanceId?: string(name='DatabaseInstanceId', description='The ID of the Simple Database Service instance.

This parameter is required.', example='db-38263fa955774501a2ae1bdaed6f****'),
  regionId?: string(name='RegionId', description='The region ID of the Simple Database Service instance. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model ReleasePublicConnectionResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model ReleasePublicConnectionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ReleasePublicConnectionResponseBody(name='body'),
}

/**
 * @summary If you no longer need to use a public endpoint to access a Simple Database Service instance, you can release the public endpoint.
 *
 * @description If you no longer need to use a public endpoint to access a Simple Database Service instance, you can release the public endpoint.
 * ### QPS limit
 * You can call this API operation up to 10 times per minute per account. Requests that exceed this limit are dropped and you may experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see [QPS limits](https://help.aliyun.com/document_detail/347607.html).
 *
 * @param request ReleasePublicConnectionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ReleasePublicConnectionResponse
 */
async function releasePublicConnectionWithOptions(request: ReleasePublicConnectionRequest, runtime: Util.RuntimeOptions): ReleasePublicConnectionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.databaseInstanceId)) {
    query['DatabaseInstanceId'] = request.databaseInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ReleasePublicConnection',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary If you no longer need to use a public endpoint to access a Simple Database Service instance, you can release the public endpoint.
 *
 * @description If you no longer need to use a public endpoint to access a Simple Database Service instance, you can release the public endpoint.
 * ### QPS limit
 * You can call this API operation up to 10 times per minute per account. Requests that exceed this limit are dropped and you may experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see [QPS limits](https://help.aliyun.com/document_detail/347607.html).
 *
 * @param request ReleasePublicConnectionRequest
 * @return ReleasePublicConnectionResponse
 */
async function releasePublicConnection(request: ReleasePublicConnectionRequest): ReleasePublicConnectionResponse {
  var runtime = new Util.RuntimeOptions{};
  return releasePublicConnectionWithOptions(request, runtime);
}

model RemoveCustomImageShareAccountRequest {
  account?: [ long ](name='Account', description='The IDs of the Alibaba Cloud accounts with which you want to unshare the image.

This parameter is required.'),
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  imageId?: string(name='ImageId', description='The ID of the shared custom image.

This parameter is required.', example='m-2zehv38jjmwva1ee****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model RemoveCustomImageShareAccountResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model RemoveCustomImageShareAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RemoveCustomImageShareAccountResponseBody(name='body'),
}

/**
 * @summary Unshares a custom image that is shared across Alibaba Cloud accounts.
 *
 * @param request RemoveCustomImageShareAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RemoveCustomImageShareAccountResponse
 */
async function removeCustomImageShareAccountWithOptions(request: RemoveCustomImageShareAccountRequest, runtime: Util.RuntimeOptions): RemoveCustomImageShareAccountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.account)) {
    query['Account'] = request.account;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.imageId)) {
    query['ImageId'] = request.imageId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RemoveCustomImageShareAccount',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Unshares a custom image that is shared across Alibaba Cloud accounts.
 *
 * @param request RemoveCustomImageShareAccountRequest
 * @return RemoveCustomImageShareAccountResponse
 */
async function removeCustomImageShareAccount(request: RemoveCustomImageShareAccountRequest): RemoveCustomImageShareAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return removeCustomImageShareAccountWithOptions(request, runtime);
}

model RenewInstanceRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  period?: int32(name='Period', description='The renewal period. Unit: month. Valid values: 1, 3, 6, 12, 24, and 36.

This parameter is required.', example='1'),
  regionId?: string(name='RegionId', description='The region ID of the server.

This parameter is required.', example='cn-hangzhou'),
}

model RenewInstanceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
}

model RenewInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RenewInstanceResponseBody(name='body'),
}

/**
 * @summary Renews a simple application server.
 *
 * @description *   Before you call this operation, we recommend that you understand the billing of Simple Application Server. For more information, see [Billable items](https://help.aliyun.com/document_detail/58623.html).
 * *   Before you call this operation, make sure that the balance in your account is sufficient. If the balance in your account is insufficient, the renewal fails.
 *
 * @param request RenewInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RenewInstanceResponse
 */
async function renewInstanceWithOptions(request: RenewInstanceRequest, runtime: Util.RuntimeOptions): RenewInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.period)) {
    query['Period'] = request.period;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RenewInstance',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Renews a simple application server.
 *
 * @description *   Before you call this operation, we recommend that you understand the billing of Simple Application Server. For more information, see [Billable items](https://help.aliyun.com/document_detail/58623.html).
 * *   Before you call this operation, make sure that the balance in your account is sufficient. If the balance in your account is insufficient, the renewal fails.
 *
 * @param request RenewInstanceRequest
 * @return RenewInstanceResponse
 */
async function renewInstance(request: RenewInstanceRequest): RenewInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return renewInstanceWithOptions(request, runtime);
}

model ResetDatabaseAccountPasswordRequest {
  accountPassword?: string(name='AccountPassword', description='The password of the administrator account of the Simple Database Service instance.

This parameter is required.', example='Password****'),
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  databaseInstanceId?: string(name='DatabaseInstanceId', description='The ID of the Simple Database Service instance.

This parameter is required.', example='db-38263fa955774501a2ae1bdaed6f****'),
  regionId?: string(name='RegionId', description='The region ID of the Simple Database Service instance. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model ResetDatabaseAccountPasswordResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model ResetDatabaseAccountPasswordResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ResetDatabaseAccountPasswordResponseBody(name='body'),
}

/**
 * @summary If the password of your Simple Database Service instance is not strong, you can call this operation to change the password of the administrator account of the instance. To ensure security of the instance, we recommend that you regularly change the password of the instance.
 *
 * @description If the password of your Simple Database Service instance is not strong, you can call this operation to change the password of the administrator account of the instance. To ensure security of the instance, we recommend that you regularly change the password of the instance.
 * ### QPS limit
 * You can call this API operation up to 10 times per minute per account. Requests that exceed this limit are dropped and you may experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see [QPS limits](https://help.aliyun.com/document_detail/347607.html).
 *
 * @param request ResetDatabaseAccountPasswordRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ResetDatabaseAccountPasswordResponse
 */
async function resetDatabaseAccountPasswordWithOptions(request: ResetDatabaseAccountPasswordRequest, runtime: Util.RuntimeOptions): ResetDatabaseAccountPasswordResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountPassword)) {
    query['AccountPassword'] = request.accountPassword;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.databaseInstanceId)) {
    query['DatabaseInstanceId'] = request.databaseInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ResetDatabaseAccountPassword',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary If the password of your Simple Database Service instance is not strong, you can call this operation to change the password of the administrator account of the instance. To ensure security of the instance, we recommend that you regularly change the password of the instance.
 *
 * @description If the password of your Simple Database Service instance is not strong, you can call this operation to change the password of the administrator account of the instance. To ensure security of the instance, we recommend that you regularly change the password of the instance.
 * ### QPS limit
 * You can call this API operation up to 10 times per minute per account. Requests that exceed this limit are dropped and you may experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see [QPS limits](https://help.aliyun.com/document_detail/347607.html).
 *
 * @param request ResetDatabaseAccountPasswordRequest
 * @return ResetDatabaseAccountPasswordResponse
 */
async function resetDatabaseAccountPassword(request: ResetDatabaseAccountPasswordRequest): ResetDatabaseAccountPasswordResponse {
  var runtime = new Util.RuntimeOptions{};
  return resetDatabaseAccountPasswordWithOptions(request, runtime);
}

model ResetDiskRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  diskId?: string(name='DiskId', description='The ID of the disk to be rolled back.

This parameter is required.', example='d-bp14wq0149cpp2xy****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server for which the snapshot is created.

This parameter is required.', example='cn-hangzhou'),
  snapshotId?: string(name='SnapshotId', description='The snapshot ID.

This parameter is required.', example='s-bp16oazlsold4dks****'),
}

model ResetDiskResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model ResetDiskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ResetDiskResponseBody(name='body'),
}

/**
 * @summary Rolls back a disk based on a snapshot.
 *
 * @description *   You can call this operation only if the associated simple application server is in the Stopped state.
 * *   If you restore a disk from a snapshot, the incremental data after the snapshot is created is lost. We recommend that you back up the data before you perform this operation.
 * ### [](#)Precautions
 * Resetting the system or changing the image of a simple application server clears the disk data on the server. Snapshots created before the reset or change are retained but cannot be used to restore disks.
 *
 * @param request ResetDiskRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ResetDiskResponse
 */
async function resetDiskWithOptions(request: ResetDiskRequest, runtime: Util.RuntimeOptions): ResetDiskResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.diskId)) {
    query['DiskId'] = request.diskId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.snapshotId)) {
    query['SnapshotId'] = request.snapshotId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ResetDisk',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Rolls back a disk based on a snapshot.
 *
 * @description *   You can call this operation only if the associated simple application server is in the Stopped state.
 * *   If you restore a disk from a snapshot, the incremental data after the snapshot is created is lost. We recommend that you back up the data before you perform this operation.
 * ### [](#)Precautions
 * Resetting the system or changing the image of a simple application server clears the disk data on the server. Snapshots created before the reset or change are retained but cannot be used to restore disks.
 *
 * @param request ResetDiskRequest
 * @return ResetDiskResponse
 */
async function resetDisk(request: ResetDiskRequest): ResetDiskResponse {
  var runtime = new Util.RuntimeOptions{};
  return resetDiskWithOptions(request, runtime);
}

model ResetSystemRequest {
  clientToken?: string(name='ClientToken', description='The client token that you want to use to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The **token** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [Ensure idempotence](https://help.aliyun.com/document_detail/25693.html)', example='123e4567-e89b-12d3-a456-426655440000'),
  imageId?: string(name='ImageId', description='The ID of the destination image. If you do not specify this parameter, the current image is reset.', example='794c230fd3e64ea19f83f4d7a0ad****'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  loginCredentials?: {
    keyPairName?: string(name='KeyPairName'),
    password?: string(name='Password'),
  }(name='LoginCredentials'),
  regionId?: string(name='RegionId', description='The region ID. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model ResetSystemResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model ResetSystemResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ResetSystemResponseBody(name='body'),
}

/**
 * @summary Resets a simple application server.
 *
 * @description You can reset a simple application server to re-install its applications or operating system and re-initialize the server. You can reset a simple application server by resetting the current system or changing the image.
 * *   Reset the current system: You can re-install the operating system without changing the image.
 * *   Change the image: You can select another Alibaba Cloud image or a custom image to re-install the operating system.
 * ### [](#)Precautions
 * *   Resetting the system or changing the image of a simple application server clears the disk data on the server. Back up the data as needed.
 * *   After you reset a simple application server, monitoring may fail. In this case, you can use one of the following methods to install the CloudMonitor agent on the server:
 *     *   Connect to the server: For more information, see [Manually install the CloudMonitor agent for C++ on an ECS instance](https://help.aliyun.com/document_detail/183482.html).
 *     *   Use Command Assistant: For more information, see [Use Command Assistant](https://help.aliyun.com/document_detail/438681.html). You can obtain the command that can be used to install CloudMonitor from the "Common commands" section of the [Use Command Assistant](https://help.aliyun.com/document_detail/438681.html) topic.
 * ### [](#)Limits
 * *   Snapshots that are created before the reset are retained, but the snapshots cannot be used to restore the disks of the server.
 * *   You cannot reset simple application servers that were created from custom images that contain data of data disks.
 * *   If you reset a simple application server by replacing the existing image with a custom image, the following limits apply:
 *     *   The custom image must reside in the same region as the current server.
 *     *   The custom image cannot be created based on the current server. If you want to restore the data on the server, you can use a snapshot of the server to restore disk data.
 *     *   If your simple application server resides in a region outside the Chinese mainland, you cannot switch the operating system of the server between Windows Server and Linux. You cannot use a Windows Server custom image to reset a Linux simple application server. Similarly, you cannot use a Linux custom image to reset a Windows Server simple application server. You can switch the operating systems of simple application servers only between Windows Server versions or between Linux distributions.
 *     *   The following limits apply to the disks attached to the simple application server:
 *         *   If the custom image contains a system disk and a data disk but only a system disk is attached to the simple application server, you cannot use the custom image to reset the simple application server.
 *         *   If the system disk size of the custom image is greater than the system disk size of the simple application server, you cannot directly use the custom image to reset the simple application server.
 *         *   Only if the system disk size of the simple application server is greater than or equal to the system disk size of the custom image, you can use the custom image to reset the simple application server. To increase the system disk size of your server, you can upgrade the server configuration. For more information, see Upgrade a simple application server.
 *         *   If the data disk size of the custom image is greater than the data disk size of the simple application server, you cannot use the custom image to reset the simple application server.
 *
 * @param request ResetSystemRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ResetSystemResponse
 */
async function resetSystemWithOptions(request: ResetSystemRequest, runtime: Util.RuntimeOptions): ResetSystemResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.imageId)) {
    query['ImageId'] = request.imageId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.loginCredentials)) {
    query['LoginCredentials'] = request.loginCredentials;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ResetSystem',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Resets a simple application server.
 *
 * @description You can reset a simple application server to re-install its applications or operating system and re-initialize the server. You can reset a simple application server by resetting the current system or changing the image.
 * *   Reset the current system: You can re-install the operating system without changing the image.
 * *   Change the image: You can select another Alibaba Cloud image or a custom image to re-install the operating system.
 * ### [](#)Precautions
 * *   Resetting the system or changing the image of a simple application server clears the disk data on the server. Back up the data as needed.
 * *   After you reset a simple application server, monitoring may fail. In this case, you can use one of the following methods to install the CloudMonitor agent on the server:
 *     *   Connect to the server: For more information, see [Manually install the CloudMonitor agent for C++ on an ECS instance](https://help.aliyun.com/document_detail/183482.html).
 *     *   Use Command Assistant: For more information, see [Use Command Assistant](https://help.aliyun.com/document_detail/438681.html). You can obtain the command that can be used to install CloudMonitor from the "Common commands" section of the [Use Command Assistant](https://help.aliyun.com/document_detail/438681.html) topic.
 * ### [](#)Limits
 * *   Snapshots that are created before the reset are retained, but the snapshots cannot be used to restore the disks of the server.
 * *   You cannot reset simple application servers that were created from custom images that contain data of data disks.
 * *   If you reset a simple application server by replacing the existing image with a custom image, the following limits apply:
 *     *   The custom image must reside in the same region as the current server.
 *     *   The custom image cannot be created based on the current server. If you want to restore the data on the server, you can use a snapshot of the server to restore disk data.
 *     *   If your simple application server resides in a region outside the Chinese mainland, you cannot switch the operating system of the server between Windows Server and Linux. You cannot use a Windows Server custom image to reset a Linux simple application server. Similarly, you cannot use a Linux custom image to reset a Windows Server simple application server. You can switch the operating systems of simple application servers only between Windows Server versions or between Linux distributions.
 *     *   The following limits apply to the disks attached to the simple application server:
 *         *   If the custom image contains a system disk and a data disk but only a system disk is attached to the simple application server, you cannot use the custom image to reset the simple application server.
 *         *   If the system disk size of the custom image is greater than the system disk size of the simple application server, you cannot directly use the custom image to reset the simple application server.
 *         *   Only if the system disk size of the simple application server is greater than or equal to the system disk size of the custom image, you can use the custom image to reset the simple application server. To increase the system disk size of your server, you can upgrade the server configuration. For more information, see Upgrade a simple application server.
 *         *   If the data disk size of the custom image is greater than the data disk size of the simple application server, you cannot use the custom image to reset the simple application server.
 *
 * @param request ResetSystemRequest
 * @return ResetSystemResponse
 */
async function resetSystem(request: ResetSystemRequest): ResetSystemResponse {
  var runtime = new Util.RuntimeOptions{};
  return resetSystemWithOptions(request, runtime);
}

model RestartDatabaseInstanceRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  databaseInstanceId?: string(name='DatabaseInstanceId', description='The ID of the Simple Database Service instance.

This parameter is required.', example='db-38263fa955774501a2ae1bdaed6f****'),
  regionId?: string(name='RegionId', description='The region ID of the Simple Database Service instance. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model RestartDatabaseInstanceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model RestartDatabaseInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RestartDatabaseInstanceResponseBody(name='body'),
}

/**
 * @summary You can call this operation to restart a Simple Database Service instance that is in the Running state.
 *
 * @description You can call this operation to restart a Simple Database Service instance that is in the Running state.
 * ### QPS limit
 * You can call this API operation up to 10 times per minute per account. Requests that exceed this limit are dropped and you may experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see [QPS limits](https://help.aliyun.com/document_detail/347607.html).
 *
 * @param request RestartDatabaseInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RestartDatabaseInstanceResponse
 */
async function restartDatabaseInstanceWithOptions(request: RestartDatabaseInstanceRequest, runtime: Util.RuntimeOptions): RestartDatabaseInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.databaseInstanceId)) {
    query['DatabaseInstanceId'] = request.databaseInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RestartDatabaseInstance',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary You can call this operation to restart a Simple Database Service instance that is in the Running state.
 *
 * @description You can call this operation to restart a Simple Database Service instance that is in the Running state.
 * ### QPS limit
 * You can call this API operation up to 10 times per minute per account. Requests that exceed this limit are dropped and you may experience service interruptions. We recommend that you take note of this limit when you call this operation. For more information, see [QPS limits](https://help.aliyun.com/document_detail/347607.html).
 *
 * @param request RestartDatabaseInstanceRequest
 * @return RestartDatabaseInstanceResponse
 */
async function restartDatabaseInstance(request: RestartDatabaseInstanceRequest): RestartDatabaseInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return restartDatabaseInstanceWithOptions(request, runtime);
}

model RunCommandRequest {
  commandContent?: string(name='CommandContent', description='The content of the command. Take note of the following items:

*   If you set `EnableParameter` to true, the custom parameter feature is enabled in the command content and you can configure custom parameters based on the following rules:
*   Define custom parameters in the {{}} format. Within `{{}}`, the spaces and line feeds before and after the parameter names are ignored.
*   The number of custom parameters cannot be greater than 20.
*   A custom parameter name can contain only letters, digits, underscores (_), and hyphens (-). The name is case-insensitive.
*   Each custom parameter name cannot exceed 64 bytes in length.

This parameter is required.', example='ifconfig -s'),
  enableParameter?: boolean(name='EnableParameter', description='Specifies whether to enable the custom parameter feature.

Default value: false.', example='false'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  name?: string(name='Name', description='The name of the command.

This parameter is required.', example='testName'),
  parameters?: map[string]any(name='Parameters', description='The custom parameters in the key-value pair format that are to be passed in when the command includes custom parameters. For example, if the command content is `echo {{name}}`, you can use `Parameters` to pass in the `{"name":"Jack"}` key-value pair. The `name` key of the custom parameter is automatically replaced with the paired Jack value to generate a new command. As a result, the `echo Jack` command is executed.

Number of custom parameters ranges from 0 to 20. Take note of the following items:

*   The key cannot be an empty string. It can be up to 64 characters in length.
*   The value can be an empty string.
*   After custom parameters and original command content are encoded in Base64, the command cannot exceed 16 KB in size.
*   The custom parameter names that are specified by Parameters must be included in the custom parameter names that you specified when you created the command. You can use empty strings to represent the parameters that are not passed in.

This parameter is empty by default, which indicates to disable the custom parameter feature.', example='{"name":"Jack", "accessKey":"LTAIdyvdIqaRY****"}'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  timeout?: int32(name='Timeout', description='The timeout period of the command on the server.

If a command execution task times out, Command Assistant forcibly terminates the task process. Valid values: 10 to 86400. Unit: seconds. The period of 86400 seconds is equal to 24 hours.

Default value: 60.', example='60'),
  type?: string(name='Type', description='The language type of the command. Valid values:

*   RunBatScript: batch commands (applicable to Windows servers).
*   RunPowerShellScript: PowerShell commands (applicable to Windows servers).
*   RunShellScript: shell commands (applicable to Linux servers).

This parameter is required.', example='RunShellScript'),
  windowsPasswordName?: string(name='WindowsPasswordName', description='The name of the password used to run the command on a Windows simple application server.

If you want to use a username other than the default "system" username to run the command on a Windows server, you must specify both the WindowsPasswordName and WorkingUser parameters. The password is hosted in plaintext in the parameter repository of CloudOps Orchestration Service (OOS) to mitigate the risk of password leaks. Only the name of the password is passed in by using WindowsPasswordName.', example='axtSecretPassword'),
  workingDir?: string(name='WorkingDir', description='The execution path of the command. Custom paths are supported. Default execution paths vary based on the operating systems of the servers.

*   For Linux servers, the default path is /root of the root user.
*   For Windows servers, the default path is C:\\\\Windows\\\\system32.', example='/home/'),
  workingUser?: string(name='WorkingUser', description='A user of the server who runs the command. We recommend that you run the command as a regular user to reduce security risks. Default values:

*   For Linux servers, the default value is root.
*   For Windows servers, the default value is system.', example='root'),
}

model RunCommandShrinkRequest {
  commandContent?: string(name='CommandContent', description='The content of the command. Take note of the following items:

*   If you set `EnableParameter` to true, the custom parameter feature is enabled in the command content and you can configure custom parameters based on the following rules:
*   Define custom parameters in the {{}} format. Within `{{}}`, the spaces and line feeds before and after the parameter names are ignored.
*   The number of custom parameters cannot be greater than 20.
*   A custom parameter name can contain only letters, digits, underscores (_), and hyphens (-). The name is case-insensitive.
*   Each custom parameter name cannot exceed 64 bytes in length.

This parameter is required.', example='ifconfig -s'),
  enableParameter?: boolean(name='EnableParameter', description='Specifies whether to enable the custom parameter feature.

Default value: false.', example='false'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  name?: string(name='Name', description='The name of the command.

This parameter is required.', example='testName'),
  parametersShrink?: string(name='Parameters', description='The custom parameters in the key-value pair format that are to be passed in when the command includes custom parameters. For example, if the command content is `echo {{name}}`, you can use `Parameters` to pass in the `{"name":"Jack"}` key-value pair. The `name` key of the custom parameter is automatically replaced with the paired Jack value to generate a new command. As a result, the `echo Jack` command is executed.

Number of custom parameters ranges from 0 to 20. Take note of the following items:

*   The key cannot be an empty string. It can be up to 64 characters in length.
*   The value can be an empty string.
*   After custom parameters and original command content are encoded in Base64, the command cannot exceed 16 KB in size.
*   The custom parameter names that are specified by Parameters must be included in the custom parameter names that you specified when you created the command. You can use empty strings to represent the parameters that are not passed in.

This parameter is empty by default, which indicates to disable the custom parameter feature.', example='{"name":"Jack", "accessKey":"LTAIdyvdIqaRY****"}'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  timeout?: int32(name='Timeout', description='The timeout period of the command on the server.

If a command execution task times out, Command Assistant forcibly terminates the task process. Valid values: 10 to 86400. Unit: seconds. The period of 86400 seconds is equal to 24 hours.

Default value: 60.', example='60'),
  type?: string(name='Type', description='The language type of the command. Valid values:

*   RunBatScript: batch commands (applicable to Windows servers).
*   RunPowerShellScript: PowerShell commands (applicable to Windows servers).
*   RunShellScript: shell commands (applicable to Linux servers).

This parameter is required.', example='RunShellScript'),
  windowsPasswordName?: string(name='WindowsPasswordName', description='The name of the password used to run the command on a Windows simple application server.

If you want to use a username other than the default "system" username to run the command on a Windows server, you must specify both the WindowsPasswordName and WorkingUser parameters. The password is hosted in plaintext in the parameter repository of CloudOps Orchestration Service (OOS) to mitigate the risk of password leaks. Only the name of the password is passed in by using WindowsPasswordName.', example='axtSecretPassword'),
  workingDir?: string(name='WorkingDir', description='The execution path of the command. Custom paths are supported. Default execution paths vary based on the operating systems of the servers.

*   For Linux servers, the default path is /root of the root user.
*   For Windows servers, the default path is C:\\\\Windows\\\\system32.', example='/home/'),
  workingUser?: string(name='WorkingUser', description='A user of the server who runs the command. We recommend that you run the command as a regular user to reduce security risks. Default values:

*   For Linux servers, the default value is root.
*   For Windows servers, the default value is system.', example='root'),
}

model RunCommandResponseBody = {
  invokeId?: string(name='InvokeId', description='The execution ID.', example='t-hz02p9545t6****'),
  requestId?: string(name='RequestId', description='The request ID.', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3****'),
}

model RunCommandResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RunCommandResponseBody(name='body'),
}

/**
 * @summary Runs commands on a simple application server.
 *
 * @description Command Assistant is an automated O\\&M tool for Simple Application Server. You can maintain simple application servers by running shell, PowerShell, and batch commands in the Simple Application Server console without remotely logging on to the servers.
 * Before you use Command Assistant, take note of the following items:
 * *   The simple application server must be in the Running state.
 * *   The Cloud Assistant client is installed on the server. By default, the Cloud Assistant client is installed on simple application servers. If you have manually uninstalled the client, you must reinstall it. For more information, see [Install the Cloud Assistant Agent](https://help.aliyun.com/document_detail/64921.html).
 *
 * @param tmpReq RunCommandRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RunCommandResponse
 */
async function runCommandWithOptions(tmpReq: RunCommandRequest, runtime: Util.RuntimeOptions): RunCommandResponse {
  Util.validateModel(tmpReq);
  var request = new RunCommandShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.parameters)) {
    request.parametersShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.parameters, 'Parameters', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.commandContent)) {
    query['CommandContent'] = request.commandContent;
  }
  if (!Util.isUnset(request.enableParameter)) {
    query['EnableParameter'] = request.enableParameter;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.parametersShrink)) {
    query['Parameters'] = request.parametersShrink;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.timeout)) {
    query['Timeout'] = request.timeout;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  if (!Util.isUnset(request.windowsPasswordName)) {
    query['WindowsPasswordName'] = request.windowsPasswordName;
  }
  if (!Util.isUnset(request.workingDir)) {
    query['WorkingDir'] = request.workingDir;
  }
  if (!Util.isUnset(request.workingUser)) {
    query['WorkingUser'] = request.workingUser;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RunCommand',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Runs commands on a simple application server.
 *
 * @description Command Assistant is an automated O\\&M tool for Simple Application Server. You can maintain simple application servers by running shell, PowerShell, and batch commands in the Simple Application Server console without remotely logging on to the servers.
 * Before you use Command Assistant, take note of the following items:
 * *   The simple application server must be in the Running state.
 * *   The Cloud Assistant client is installed on the server. By default, the Cloud Assistant client is installed on simple application servers. If you have manually uninstalled the client, you must reinstall it. For more information, see [Install the Cloud Assistant Agent](https://help.aliyun.com/document_detail/64921.html).
 *
 * @param request RunCommandRequest
 * @return RunCommandResponse
 */
async function runCommand(request: RunCommandRequest): RunCommandResponse {
  var runtime = new Util.RuntimeOptions{};
  return runCommandWithOptions(request, runtime);
}

model StartDatabaseInstanceRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  databaseInstanceId?: string(name='DatabaseInstanceId', description='The ID of the Simple Database Service instance.

This parameter is required.', example='db-38263fa955774501a2ae1bdaed6f****'),
  regionId?: string(name='RegionId', description='The region ID of the Simple Database Service instance. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model StartDatabaseInstanceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model StartDatabaseInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StartDatabaseInstanceResponseBody(name='body'),
}

/**
 * @summary Starts a Simple Database Service instance.
 *
 * @description You can call this operation to start a Simple Database Service instance that is in the Stopped state.
 *
 * @param request StartDatabaseInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StartDatabaseInstanceResponse
 */
async function startDatabaseInstanceWithOptions(request: StartDatabaseInstanceRequest, runtime: Util.RuntimeOptions): StartDatabaseInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.databaseInstanceId)) {
    query['DatabaseInstanceId'] = request.databaseInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StartDatabaseInstance',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Starts a Simple Database Service instance.
 *
 * @description You can call this operation to start a Simple Database Service instance that is in the Stopped state.
 *
 * @param request StartDatabaseInstanceRequest
 * @return StartDatabaseInstanceResponse
 */
async function startDatabaseInstance(request: StartDatabaseInstanceRequest): StartDatabaseInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return startDatabaseInstanceWithOptions(request, runtime);
}

model StartInstanceRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  regionId?: string(name='RegionId', description='The region ID of the server.

This parameter is required.', example='cn-hangzhou'),
}

model StartInstanceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
}

model StartInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StartInstanceResponseBody(name='body'),
}

/**
 * @summary Starts a simple application server.
 *
 * @description You can call this operation to start a simple application server that is in the Stopped state.
 *
 * @param request StartInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StartInstanceResponse
 */
async function startInstanceWithOptions(request: StartInstanceRequest, runtime: Util.RuntimeOptions): StartInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StartInstance',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Starts a simple application server.
 *
 * @description You can call this operation to start a simple application server that is in the Stopped state.
 *
 * @param request StartInstanceRequest
 * @return StartInstanceResponse
 */
async function startInstance(request: StartInstanceRequest): StartInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return startInstanceWithOptions(request, runtime);
}

model StartInstancesRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceIds?: string(name='InstanceIds', description='The IDs of the simple application servers. The value can be a JSON array that consists of up to 100 simple application server IDs. Separate multiple server IDs with commas (,).

This parameter is required.', example='["2ad1ae67295445f598017499dc****", "2ad1ae67295445f598017123dc****"]'),
  regionId?: string(name='RegionId', description='The region ID of the simple application servers. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model StartInstancesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model StartInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StartInstancesResponseBody(name='body'),
}

/**
 * @summary Starts simple application servers.
 *
 * @param request StartInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StartInstancesResponse
 */
async function startInstancesWithOptions(request: StartInstancesRequest, runtime: Util.RuntimeOptions): StartInstancesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceIds)) {
    query['InstanceIds'] = request.instanceIds;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StartInstances',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Starts simple application servers.
 *
 * @param request StartInstancesRequest
 * @return StartInstancesResponse
 */
async function startInstances(request: StartInstancesRequest): StartInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return startInstancesWithOptions(request, runtime);
}

model StartTerminalSessionRequest {
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model StartTerminalSessionResponseBody = {
  requestId?: string(name='RequestId', description='Id of the request', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
  securityToken?: string(name='SecurityToken', description='The security token included in the WebSocket request header. The system uses this token to authenticate the request.', example='token-xxxaaz'),
  sessionId?: string(name='SessionId', description='The session ID.', example='ffb90b6e-b18a-4a33-88cf-86fb88****'),
  webSocketUrl?: string(name='WebSocketUrl', description='The URL of the WebSocket session that is used to connect to the server. The URL contains the session ID (`SessionId`) and the authentication token (`SecurityToken`).', example='wss://xxxx'),
}

model StartTerminalSessionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StartTerminalSessionResponseBody(name='body'),
}

/**
 * @summary Creates a session for a simple application server.
 *
 * @param request StartTerminalSessionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StartTerminalSessionResponse
 */
async function startTerminalSessionWithOptions(request: StartTerminalSessionRequest, runtime: Util.RuntimeOptions): StartTerminalSessionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StartTerminalSession',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Creates a session for a simple application server.
 *
 * @param request StartTerminalSessionRequest
 * @return StartTerminalSessionResponse
 */
async function startTerminalSession(request: StartTerminalSessionRequest): StartTerminalSessionResponse {
  var runtime = new Util.RuntimeOptions{};
  return startTerminalSessionWithOptions(request, runtime);
}

model StopDatabaseInstanceRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  databaseInstanceId?: string(name='DatabaseInstanceId', description='The ID of the Simple Database Service instance.

This parameter is required.', example='db-38263fa955774501a2ae1bdaed6f****'),
  regionId?: string(name='RegionId', description='The region ID of the Simple Database Service instance. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model StopDatabaseInstanceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='30637AD6-D977-4833-A54C-CC89483E****'),
}

model StopDatabaseInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StopDatabaseInstanceResponseBody(name='body'),
}

/**
 * @summary Stops a Simple Database Service instance.
 *
 * @description You can call this operation to stop a Simple Database Service instance that is in the Running state. After the instance is stopped, you cannot log on to or access the instance.
 *
 * @param request StopDatabaseInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StopDatabaseInstanceResponse
 */
async function stopDatabaseInstanceWithOptions(request: StopDatabaseInstanceRequest, runtime: Util.RuntimeOptions): StopDatabaseInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.databaseInstanceId)) {
    query['DatabaseInstanceId'] = request.databaseInstanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StopDatabaseInstance',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Stops a Simple Database Service instance.
 *
 * @description You can call this operation to stop a Simple Database Service instance that is in the Running state. After the instance is stopped, you cannot log on to or access the instance.
 *
 * @param request StopDatabaseInstanceRequest
 * @return StopDatabaseInstanceResponse
 */
async function stopDatabaseInstance(request: StopDatabaseInstanceRequest): StopDatabaseInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return stopDatabaseInstanceWithOptions(request, runtime);
}

model StopInstanceRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  regionId?: string(name='RegionId', description='The region ID of the server.

This parameter is required.', example='cn-hangzhou'),
}

model StopInstanceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model StopInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StopInstanceResponseBody(name='body'),
}

/**
 * @summary Stops a simple application server.
 *
 * @description You can stop a simple application server that you do not use for the time being.
 * >  Stopping a simple application server may interrupt your business. We recommend that you perform this operation during off-peak hours.
 *
 * @param request StopInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StopInstanceResponse
 */
async function stopInstanceWithOptions(request: StopInstanceRequest, runtime: Util.RuntimeOptions): StopInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StopInstance',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Stops a simple application server.
 *
 * @description You can stop a simple application server that you do not use for the time being.
 * >  Stopping a simple application server may interrupt your business. We recommend that you perform this operation during off-peak hours.
 *
 * @param request StopInstanceRequest
 * @return StopInstanceResponse
 */
async function stopInstance(request: StopInstanceRequest): StopInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return stopInstanceWithOptions(request, runtime);
}

model StopInstancesRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  forceStop?: boolean(name='ForceStop', description='Specifies whether to forcibly stop the servers.

*   **true**: forcibly stops the servers.
*   **false**: normally stops the servers. This is the default value.', example='true'),
  instanceIds?: string(name='InstanceIds', description='The IDs of the simple application servers. The value can be a JSON array that consists of up to 100 simple application server IDs. Separate multiple server IDs with commas (,).

This parameter is required.', example='["2ad1ae67295445f598017499dc****", "2ad1ae67295445f598017123dc****"]'),
  regionId?: string(name='RegionId', description='The region ID of the simple application servers. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model StopInstancesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='C2DE174B-7196-5778-A00D-6EA2601B****'),
}

model StopInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StopInstancesResponseBody(name='body'),
}

/**
 * @summary Stops simple application servers.
 *
 * @param request StopInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StopInstancesResponse
 */
async function stopInstancesWithOptions(request: StopInstancesRequest, runtime: Util.RuntimeOptions): StopInstancesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.forceStop)) {
    query['ForceStop'] = request.forceStop;
  }
  if (!Util.isUnset(request.instanceIds)) {
    query['InstanceIds'] = request.instanceIds;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StopInstances',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Stops simple application servers.
 *
 * @param request StopInstancesRequest
 * @return StopInstancesResponse
 */
async function stopInstances(request: StopInstancesRequest): StopInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return stopInstancesWithOptions(request, runtime);
}

model TagResourcesRequest {
  clientToken?: string(name='ClientToken', description='The client token that you want to use to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [Ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  regionId?: string(name='RegionId', description='The region ID.

This parameter is required.', example='cn-hangzhou'),
  resourceId?: [ string ](name='ResourceId', description='The resource IDs. You can specify up to 50 resource IDs.

This parameter is required.'),
  resourceType?: string(name='ResourceType', description='The resource type. Valid values:

*   instance
*   snapshot
*   customimage
*   command
*   firewallrule
*   disk

This parameter is required.', example='instance'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of tag N that you want to add to a resource.

You cannot specify an empty string as a tag key. The tag key can be up to 64 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.', example='TestKey'),
      value?: string(name='Value', description='The value of tag N that you want to add to a resource.

You can specify an empty string as a tag value. The tag value can be up to 64 characters in length and cannot contain http:// or https://.', example='TestValue'),
    }
  ](name='Tag', description='The list of tags. You can specify up to 20 tags.

This parameter is required.'),
}

model TagResourcesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model TagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: TagResourcesResponseBody(name='body'),
}

/**
 * @summary Adds tags to simple application servers, snapshots, custom images, commands, firewall rules, and disks to facilitate the viewing and management of the preceding resources.
 *
 * @param request TagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return TagResourcesResponse
 */
async function tagResourcesWithOptions(request: TagResourcesRequest, runtime: Util.RuntimeOptions): TagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'TagResources',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Adds tags to simple application servers, snapshots, custom images, commands, firewall rules, and disks to facilitate the viewing and management of the preceding resources.
 *
 * @param request TagResourcesRequest
 * @return TagResourcesResponse
 */
async function tagResources(request: TagResourcesRequest): TagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return tagResourcesWithOptions(request, runtime);
}

model UntagResourcesRequest {
  all?: boolean(name='All', description='Specifies whether to remove all tags from the specified one or more resources. This parameter takes effect only if the TagKey.N parameter is not set. Valid values:

*   true: deletes all tags that are added to the specific lightweight resource. If no tags are added to the specific lightweight resource, the deletion operation is ignored.
*   false: does not delete the tags that are added to the specific lightweight resource.

Default value: false.', example='false'),
  clientToken?: string(name='ClientToken', description='The client token that you want to use to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [Ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  regionId?: string(name='RegionId', description='The region ID.

This parameter is required.', example='cn-hangzhou'),
  resourceId?: [ string ](name='ResourceId', description='The resource IDs. You can specify up to 50 resource IDs.

This parameter is required.'),
  resourceType?: string(name='ResourceType', description='The resource type. Valid values:

*   instance
*   snapshot
*   customimage
*   command
*   firewallrule
*   disk

This parameter is required.', example='instance'),
  tagKey?: [ string ](name='TagKey', description='The key of tag N. Valid values of N: 1 to 20.'),
}

model UntagResourcesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model UntagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UntagResourcesResponseBody(name='body'),
}

/**
 * @summary Unbinds and deletes tags from specified lightweight resources, such as instances, snapshots, disks, images, commands, and firewall rules.
 *
 * @param request UntagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UntagResourcesResponse
 */
async function untagResourcesWithOptions(request: UntagResourcesRequest, runtime: Util.RuntimeOptions): UntagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.all)) {
    query['All'] = request.all;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tagKey)) {
    query['TagKey'] = request.tagKey;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UntagResources',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Unbinds and deletes tags from specified lightweight resources, such as instances, snapshots, disks, images, commands, and firewall rules.
 *
 * @param request UntagResourcesRequest
 * @return UntagResourcesResponse
 */
async function untagResources(request: UntagResourcesRequest): UntagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return untagResourcesWithOptions(request, runtime);
}

model UpdateCommandAttributeRequest {
  commandId?: string(name='CommandId', description='The command ID. You can call the [DescribeCommands](https://help.aliyun.com/document_detail/64843.html) operation to query all available command IDs.

This parameter is required.', example='c-sh02yh0932w****'),
  description?: string(name='Description', description='The description of the command. The description supports all character sets and can be up to 512 characters in length.', example='test'),
  name?: string(name='Name', description='The name of the command. The name supports all character sets and can be up to 128 characters in length.', example='testName'),
  regionId?: string(name='RegionId', description='The region ID. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  timeout?: long(name='Timeout', description='The maximum timeout period for the command execution on the ECS instance. Unit: seconds. When a command that you created cannot be run, the command execution times out. When the execution times out, the command process is forcefully terminated and the PID of the command is canceled. Default value: 60.', example='60'),
  workingDir?: string(name='WorkingDir', description='The working directory of the command. The directory can be up to 200 characters in length.', example='/home/'),
}

model UpdateCommandAttributeResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3****'),
}

model UpdateCommandAttributeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateCommandAttributeResponseBody(name='body'),
}

/**
 * @summary Modifys the parameter of a command.
 *
 * @param request UpdateCommandAttributeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateCommandAttributeResponse
 */
async function updateCommandAttributeWithOptions(request: UpdateCommandAttributeRequest, runtime: Util.RuntimeOptions): UpdateCommandAttributeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.commandId)) {
    query['CommandId'] = request.commandId;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.timeout)) {
    query['Timeout'] = request.timeout;
  }
  if (!Util.isUnset(request.workingDir)) {
    query['WorkingDir'] = request.workingDir;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateCommandAttribute',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Modifys the parameter of a command.
 *
 * @param request UpdateCommandAttributeRequest
 * @return UpdateCommandAttributeResponse
 */
async function updateCommandAttribute(request: UpdateCommandAttributeRequest): UpdateCommandAttributeResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateCommandAttributeWithOptions(request, runtime);
}

model UpdateDiskAttributeRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  diskId?: string(name='DiskId', description='The disk ID. You can call the ListDisks operation to query the ID of data disk.

This parameter is required.', example='d-bp18kjxg9ebrhsgi****'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  remark?: string(name='Remark', description='The remarks of the data disk.

This parameter is required.', example='test'),
}

model UpdateDiskAttributeResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28D****534F'),
}

model UpdateDiskAttributeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateDiskAttributeResponseBody(name='body'),
}

/**
 * @summary Modifies the remarks for the data disk that is attached to a simple application server.
 *
 * @param request UpdateDiskAttributeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateDiskAttributeResponse
 */
async function updateDiskAttributeWithOptions(request: UpdateDiskAttributeRequest, runtime: Util.RuntimeOptions): UpdateDiskAttributeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.diskId)) {
    query['DiskId'] = request.diskId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.remark)) {
    query['Remark'] = request.remark;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateDiskAttribute',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Modifies the remarks for the data disk that is attached to a simple application server.
 *
 * @param request UpdateDiskAttributeRequest
 * @return UpdateDiskAttributeResponse
 */
async function updateDiskAttribute(request: UpdateDiskAttributeRequest): UpdateDiskAttributeResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateDiskAttributeWithOptions(request, runtime);
}

model UpdateInstanceAttributeRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  instanceName?: string(name='InstanceName', description='The name of the simple application server. The name must be 2 to 50 characters in length. It can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter or digit. Domain names are supported.', example='test-InstanceName'),
  password?: string(name='Password', description='The new password of the simple application server. The password must be 8 to 30 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. The following special characters are supported:

    ()`~!@#$%^&*-_+=|{}[]:;\\\\"<>,.?/

For Windows instances, the password cannot start with a forward slash (/).

>  For security reasons, we recommend that you use HTTPS to send requests if `Password` is specified.', example='Test123!'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server.

This parameter is required.', example='cn-hangzhou'),
}

model UpdateInstanceAttributeResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F534F'),
}

model UpdateInstanceAttributeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateInstanceAttributeResponseBody(name='body'),
}

/**
 * @summary Modifies the information of a simple application server, including the server name and the password that you use to log on to the server.
 *
 * @description ## [](#)Usage notes
 * After you change the password of a simple application server, you must restart the server by calling the [RebootInstance](https://help.aliyun.com/document_detail/190443.html) operation for the new password to take effect.
 *
 * @param request UpdateInstanceAttributeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateInstanceAttributeResponse
 */
async function updateInstanceAttributeWithOptions(request: UpdateInstanceAttributeRequest, runtime: Util.RuntimeOptions): UpdateInstanceAttributeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.password)) {
    query['Password'] = request.password;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateInstanceAttribute',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Modifies the information of a simple application server, including the server name and the password that you use to log on to the server.
 *
 * @description ## [](#)Usage notes
 * After you change the password of a simple application server, you must restart the server by calling the [RebootInstance](https://help.aliyun.com/document_detail/190443.html) operation for the new password to take effect.
 *
 * @param request UpdateInstanceAttributeRequest
 * @return UpdateInstanceAttributeResponse
 */
async function updateInstanceAttribute(request: UpdateInstanceAttributeRequest): UpdateInstanceAttributeResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateInstanceAttributeWithOptions(request, runtime);
}

model UpdateSnapshotAttributeRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The value of **ClientToken** can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
  remark?: string(name='Remark', description='The remarks of the snapshot of the simple application server.', example='test'),
  snapshotId?: string(name='SnapshotId', description='The snapshot ID. You can call the ListSnapshots operation to query the snapshot ID.

This parameter is required.', example='s-bp16oazlsold4dks****'),
}

model UpdateSnapshotAttributeResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='473469C7-AA6F-4DC5-B3DB-A3DC0DE3C****'),
}

model UpdateSnapshotAttributeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateSnapshotAttributeResponseBody(name='body'),
}

/**
 * @summary Modifies the remarks of a snapshot of a simple application server.
 *
 * @param request UpdateSnapshotAttributeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateSnapshotAttributeResponse
 */
async function updateSnapshotAttributeWithOptions(request: UpdateSnapshotAttributeRequest, runtime: Util.RuntimeOptions): UpdateSnapshotAttributeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.remark)) {
    query['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.snapshotId)) {
    query['SnapshotId'] = request.snapshotId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateSnapshotAttribute',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Modifies the remarks of a snapshot of a simple application server.
 *
 * @param request UpdateSnapshotAttributeRequest
 * @return UpdateSnapshotAttributeResponse
 */
async function updateSnapshotAttribute(request: UpdateSnapshotAttributeRequest): UpdateSnapshotAttributeResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateSnapshotAttributeWithOptions(request, runtime);
}

model UpgradeInstanceRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='ace0706b2ac4454d984295a94213****'),
  planId?: string(name='PlanId', description='The ID of the new plan. You can call the [ListPlans](https://help.aliyun.com/document_detail/189314.html) operation to query the plans provided by Simple Application Server.

This parameter is required.', example='swas.s2.c2m2s50b4t08'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server.

This parameter is required.', example='cn-hangzhou'),
}

model UpgradeInstanceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
}

model UpgradeInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpgradeInstanceResponseBody(name='body'),
}

/**
 * @summary Upgrades the plan for a simple application server.
 *
 * @description *   The plan of a simple application server can only be upgraded. For more information about plans, see [Billable items](https://help.aliyun.com/document_detail/58623.html).
 * *   Before you call this operation, make sure that the balance in your account is sufficient. If the balance in your account is insufficient, the upgrade fails.
 *
 * @param request UpgradeInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpgradeInstanceResponse
 */
async function upgradeInstanceWithOptions(request: UpgradeInstanceRequest, runtime: Util.RuntimeOptions): UpgradeInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.planId)) {
    query['PlanId'] = request.planId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpgradeInstance',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Upgrades the plan for a simple application server.
 *
 * @description *   The plan of a simple application server can only be upgraded. For more information about plans, see [Billable items](https://help.aliyun.com/document_detail/58623.html).
 * *   Before you call this operation, make sure that the balance in your account is sufficient. If the balance in your account is insufficient, the upgrade fails.
 *
 * @param request UpgradeInstanceRequest
 * @return UpgradeInstanceResponse
 */
async function upgradeInstance(request: UpgradeInstanceRequest): UpgradeInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return upgradeInstanceWithOptions(request, runtime);
}

model UploadInstanceKeyPairRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see [How to ensure idempotence](https://help.aliyun.com/document_detail/25693.html).', example='123e4567-e89b-12d3-a456-426655440000'),
  instanceId?: string(name='InstanceId', description='The ID of the simple application server.

This parameter is required.', example='2ad1ae67295445f598017499dc****'),
  keyPairName?: string(name='KeyPairName', description='The name of the key pair.', example='test_gin'),
  publicKey?: string(name='PublicKey', description='The public key.', example='ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID5aQ5bM0Am3mWe+upjSXqisUT4DLR6ExwvA0***** **@**.com'),
  regionId?: string(name='RegionId', description='The region ID of the simple application server. You can call the [ListRegions](https://help.aliyun.com/document_detail/189315.html) operation to query the most recent region list.

This parameter is required.', example='cn-hangzhou'),
}

model UploadInstanceKeyPairResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='20758A-585D-4A41-A9B2-28DA8F4F****'),
}

model UploadInstanceKeyPairResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UploadInstanceKeyPairResponseBody(name='body'),
}

/**
 * @summary Imports a key pair for a simple application server.
 *
 * @param request UploadInstanceKeyPairRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UploadInstanceKeyPairResponse
 */
async function uploadInstanceKeyPairWithOptions(request: UploadInstanceKeyPairRequest, runtime: Util.RuntimeOptions): UploadInstanceKeyPairResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.keyPairName)) {
    query['KeyPairName'] = request.keyPairName;
  }
  if (!Util.isUnset(request.publicKey)) {
    query['PublicKey'] = request.publicKey;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UploadInstanceKeyPair',
    version = '2020-06-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  if (Util.isUnset(@signatureVersion) || !Util.equalString(@signatureVersion, 'v4')) {
    return callApi(params, req, runtime);
  } else {
    return execute(params, req, runtime);
  }
}

/**
 * @summary Imports a key pair for a simple application server.
 *
 * @param request UploadInstanceKeyPairRequest
 * @return UploadInstanceKeyPairResponse
 */
async function uploadInstanceKeyPair(request: UploadInstanceKeyPairRequest): UploadInstanceKeyPairResponse {
  var runtime = new Util.RuntimeOptions{};
  return uploadInstanceKeyPairWithOptions(request, runtime);
}

